⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configuration.java

📁 windows 代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

        value = _properties.getProperty("numeric-entities");
        if (value != null)
            NumEntities = parseBool(value);

        value = _properties.getProperty("quote-marks");
        if (value != null)
            QuoteMarks = parseBool(value);

        value = _properties.getProperty("quote-nbsp");
        if (value != null)
            QuoteNbsp = parseBool(value);

        value = _properties.getProperty("quote-ampersand");
        if (value != null)
            QuoteAmpersand = parseBool(value);

        value = _properties.getProperty("write-back");
        if (value != null)
            writeback = parseBool(value);

        value = _properties.getProperty("keep-time");
        if (value != null)
            KeepFileTimes = parseBool(value);

        value = _properties.getProperty("show-warnings");
        if (value != null)
            ShowWarnings = parseBool(value);

        value = _properties.getProperty("error-file");
        if (value != null)
            errfile = parseName(value);

        value = _properties.getProperty("slide-style");
        if (value != null)
            slidestyle = parseName(value);

        value = _properties.getProperty("new-inline-tags");
        if (value != null)
            parseInlineTagNames(value);

        value = _properties.getProperty("new-blocklevel-tags");
        if (value != null)
            parseBlockTagNames(value);

        value = _properties.getProperty("new-empty-tags");
        if (value != null)
            parseEmptyTagNames(value);

        value = _properties.getProperty("new-pre-tags");
        if (value != null)
            parsePreTagNames(value);

        value = _properties.getProperty("char-encoding");
        if (value != null)
            CharEncoding = parseCharEncoding(value);

        value = _properties.getProperty("doctype");
        if (value != null)
            docTypeStr = parseDocType(value);

        value = _properties.getProperty("fix-backslash");
        if (value != null)
            FixBackslash = parseBool(value);

        value = _properties.getProperty("gnu-emacs");
        if (value != null)
            Emacs = parseBool(value);
    }

    /* ensure that config is self consistent */
    public void adjust()
    {
        if (EncloseBlockText)
            EncloseBodyText = true;

        /* avoid the need to set IndentContent when SmartIndent is set */

        if (SmartIndent)
            IndentContent = true;

        /* disable wrapping */
        if (wraplen == 0)
            wraplen = 0x7FFFFFFF;

        /* Word 2000 needs o:p to be declared as inline */
        if (Word2000)
        {
            TagTable.getDefaultTagTable().defineInlineTag("o:p");
        }

        /* XHTML is written in lower case */
        if (xHTML)
        {
            XmlOut = true;
            UpperCaseTags = false;
            UpperCaseAttrs = false;
        }

        /* if XML in, then XML out */
        if (XmlTags)
        {
            XmlOut = true;
            XmlPIs = true;
        }

        /* XML requires end tags */
        if (XmlOut)
        {
            QuoteAmpersand = true;
            HideEndTags = false;
        }
    }

    private static int parseInt( String s )
    {
        int i = 0;
        try {
            i = Integer.parseInt( s );
        }
        catch ( NumberFormatException e ) {
            Report.badArgument(s);
            i = -1;
        }
        return i;
    }

    private static boolean parseBool( String s )
    {
        boolean b = false;
        if ( s != null && s.length() > 0 ) {
            char c = s.charAt(0);
            if ((c == 't') || (c == 'T') || (c == 'Y') || (c == 'y') || (c == '1'))
                b = true;
            else if ((c == 'f') || (c == 'F') || (c == 'N') || (c == 'n') || (c == '0'))
                b = false;
            else
                Report.badArgument(s);
        }
        return b;
    }

    private static boolean parseInvBool( String s )
    {
        boolean b = false;
        if ( s != null && s.length() > 0 ) {
            char c = s.charAt(0);
            if ((c == 't') || (c == 'T') || (c == 'Y') || (c == 'y'))
                b = true;
            else if ((c == 'f') || (c == 'F') || (c == 'N') || (c == 'n'))
                b = false;
            else
                Report.badArgument(s);
        }
        return !b;
    }

    private static String parseName( String s )
    {
        StringTokenizer t = new StringTokenizer( s );
        String rs = null;
        if ( t.countTokens() >= 1 )
            rs = t.nextToken();
        else
            Report.badArgument(s);
        return rs;
    }

    private static int parseCharEncoding( String s )
    {
        int result = ASCII;

        if (Lexer.wstrcasecmp(s, "ascii") == 0)
            result = ASCII;
        else if (Lexer.wstrcasecmp(s, "latin1") == 0)
            result = LATIN1;
        else if (Lexer.wstrcasecmp(s, "raw") == 0)
            result = RAW;
        else if (Lexer.wstrcasecmp(s, "utf8") == 0)
            result = UTF8;
        else if (Lexer.wstrcasecmp(s, "iso2022") == 0)
            result = ISO2022;
        else if (Lexer.wstrcasecmp(s, "mac") == 0)
            result = MACROMAN;
        else
            Report.badArgument(s);

        return result;
    }

    /* slight hack to avoid changes to pprint.c */
    private boolean parseIndent( String s )
    {
        boolean b = IndentContent;

        if (Lexer.wstrcasecmp(s, "yes") == 0)
        {
            b = true;
            SmartIndent = false;
        }
        else if (Lexer.wstrcasecmp(s, "true") == 0)
        {
            b = true;
            SmartIndent = false;
        }
        else if (Lexer.wstrcasecmp(s, "no") == 0)
        {
            b = false;
            SmartIndent = false;
        }
        else if (Lexer.wstrcasecmp(s, "false") == 0)
        {
            b = false;
            SmartIndent = false;
        }
        else if (Lexer.wstrcasecmp(s, "auto") == 0)
        {
            b = true;
            SmartIndent = true;
        }
        else
            Report.badArgument(s);
        return b;
    }

    private static void parseInlineTagNames( String s )
    {
        StringTokenizer t = new StringTokenizer( s, " \t\n\r," );
        while ( t.hasMoreTokens() ) {
            TagTable.getDefaultTagTable().defineInlineTag( t.nextToken() );
        }
    }

    private static void parseBlockTagNames( String s )
    {
        StringTokenizer t = new StringTokenizer( s, " \t\n\r," );
        while ( t.hasMoreTokens() ) {
            TagTable.getDefaultTagTable().defineBlockTag( t.nextToken() );
        }
    }

    private static void parseEmptyTagNames( String s )
    {
        StringTokenizer t = new StringTokenizer( s, " \t\n\r," );
        while ( t.hasMoreTokens() ) {
            TagTable.getDefaultTagTable().defineEmptyTag( t.nextToken() );
        }
    }

    private static void parsePreTagNames( String s )
    {
        StringTokenizer t = new StringTokenizer( s, " \t\n\r," );
        while ( t.hasMoreTokens() ) {
            TagTable.getDefaultTagTable().definePreTag( t.nextToken() );
        }
    }

    /*
       doctype: omit | auto | strict | loose | <fpi>

       where the fpi is a string similar to

          "-//ACME//DTD HTML 3.14159//EN"
    */
    protected String parseDocType(String s)
    {
        s = s.trim();

        /* "-//ACME//DTD HTML 3.14159//EN" or similar */

        if (s.startsWith("\""))
        {
            docTypeMode = DOCTYPE_USER;
            return s;
        }

        /* read first word */
        String word = "";
        StringTokenizer t = new StringTokenizer( s, " \t\n\r," );
        if (t.hasMoreTokens())
            word = t.nextToken();

        docTypeMode = DOCTYPE_AUTO;

        if (Lexer.wstrcasecmp(word, "omit") == 0)
            docTypeMode = DOCTYPE_OMIT;
        else if (Lexer.wstrcasecmp(word, "strict") == 0)
            docTypeMode = DOCTYPE_STRICT;
        else if (Lexer.wstrcasecmp(word, "loose") == 0 ||
                 Lexer.wstrcasecmp(word, "transitional") == 0)
            docTypeMode = DOCTYPE_LOOSE;
        else
            Report.badArgument(s);
        return null;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -