当前位置: 首页>>代码示例>>C#>>正文


C# Lexer.SetXhtmlDocType方法代码示例

本文整理汇总了C#中TidyNet.Lexer.SetXhtmlDocType方法的典型用法代码示例。如果您正苦于以下问题:C# Lexer.SetXhtmlDocType方法的具体用法?C# Lexer.SetXhtmlDocType怎么用?C# Lexer.SetXhtmlDocType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TidyNet.Lexer的用法示例。


在下文中一共展示了Lexer.SetXhtmlDocType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseInternal

        /// <summary> Internal routine that actually does the parsing.  The caller
        /// can pass either an InputStream or file name.  If both are passed,
        /// the file name is preferred.
        /// </summary>
        internal Node ParseInternal(Stream input, string file, Stream Output, TidyMessageCollection messages)
        {
            Lexer lexer;
            Node document = null;
            Node doctype;
            Out o = new OutImpl(); /* normal output stream */
            PPrint pprint;

            /* ensure config is self-consistent */
            _options.Adjust();

            if (file != null)
            {
                input = new FileStream(file, FileMode.Open, FileAccess.Read);
            }
            else if (input == null)
            {
                input = Console.OpenStandardInput();
            }

            if (input != null)
            {
                lexer = new Lexer(new ClsStreamInImpl(input, _options.CharEncoding, _options.TabSize), _options);
                lexer.messages = messages;

                /*
                store pointer to lexer in input stream
                to allow character encoding errors to be
                reported
                */
                lexer.input.Lexer = lexer;

                /* Tidy doesn't alter the doctype for generic XML docs */
                if (_options.XmlTags)
                {
                    document = ParserImpl.parseXMLDocument(lexer);
                }
                else
                {
                    document = ParserImpl.parseDocument(lexer);

                    if (!document.CheckNodeIntegrity())
                    {
                        Report.BadTree(lexer);
                        return null;
                    }

                    Clean cleaner = new Clean(_options.tt);

                    /* simplifies <b><b> ... </b> ...</b> etc. */
                    cleaner.NestedEmphasis(document);

                    /* cleans up <dir>indented text</dir> etc. */
                    cleaner.List2BQ(document);
                    cleaner.BQ2Div(document);

                    /* replaces i by em and b by strong */
                    if (_options.LogicalEmphasis)
                    {
                        cleaner.EmFromI(document);
                    }

                    if (_options.Word2000 && cleaner.IsWord2000(document, _options.tt))
                    {
                        /* prune Word2000's <![if ...]> ... <![endif]> */
                        cleaner.DropSections(lexer, document);

                        /* drop style & class attributes and empty p, span elements */
                        cleaner.CleanWord2000(lexer, document);
                    }

                    /* replaces presentational markup by style rules */
                    if (_options.MakeClean || _options.DropFontTags)
                    {
                        cleaner.CleanTree(lexer, document);
                    }

                    if (!document.CheckNodeIntegrity())
                    {
                        Report.BadTree(lexer);
                        return null;
                    }
                    doctype = document.FindDocType();
                    if (document.Content != null)
                    {
                        if (_options.Xhtml)
                        {
                            lexer.SetXhtmlDocType(document);
                        }
                        else
                        {
                            lexer.FixDocType(document);
                        }

                        if (_options.TidyMark)
                        {
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:101,代码来源:Tidy.cs


注:本文中的TidyNet.Lexer.SetXhtmlDocType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。