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


C# Node.FindBody方法代码示例

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


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

示例1: CreateStyleElement

        /* create style element using rules from dictionary */
        private void CreateStyleElement(Lexer lexer, Node doc)
        {
            Node node, head, body;
            Style style;
            AttVal av;

            if (lexer.styles == null && NiceBody(lexer, doc))
            {
                return;
            }

            node = lexer.NewNode(Node.StartTag, null, 0, 0, "style");
            node.Isimplicit = true;

            /* insert type attribute */
            av = new AttVal(null, null, '"', "type", "text/css");
            av.Dict = AttributeTable.DefaultAttributeTable.FindAttribute(av);
            node.Attributes = av;

            body = doc.FindBody(lexer.Options.tt);

            lexer.txtstart = lexer.lexsize;

            if (body != null)
            {
                CleanBodyAttrs(lexer, body);
            }

            for (style = lexer.styles; style != null; style = style.Next)
            {
                lexer.AddCharToLexer(' ');
                lexer.AddStringLiteral(style.Tag);
                lexer.AddCharToLexer('.');
                lexer.AddStringLiteral(style.TagClass);
                lexer.AddCharToLexer(' ');
                lexer.AddCharToLexer('{');
                lexer.AddStringLiteral(style.Properties);
                lexer.AddCharToLexer('}');
                lexer.AddCharToLexer('\n');
            }

            lexer.txtend = lexer.lexsize;

            Node.InsertNodeAtEnd(node, lexer.NewNode(Node.TextNode, lexer.lexbuf, lexer.txtstart, lexer.txtend));

            /*
            now insert style element into document head

            doc is root node. search its children for html node
            the head node should be first child of html node
            */

            head = doc.FindHead(lexer.Options.tt);

            if (head != null)
            {
                Node.InsertNodeAtEnd(head, node);
            }
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:60,代码来源:Clean.cs

示例2: NiceBody

        private bool NiceBody(Lexer lexer, Node doc)
        {
            Node body = doc.FindBody(lexer.Options.tt);

            if (body != null)
            {
                if (body.GetAttrByName("background") != null || body.GetAttrByName("bgcolor") != null || body.GetAttrByName("text") != null || body.GetAttrByName("link") != null || body.GetAttrByName("vlink") != null || body.GetAttrByName("alink") != null)
                {
                    lexer.badLayout |= Report.USING_BODY;
                    return false;
                }
            }

            return true;
        }
开发者ID:AlfieJ,项目名称:TidyNet,代码行数:15,代码来源:Clean.cs

示例3: CreateSlides

        public virtual void CreateSlides(Lexer lexer, Node root)
        {
            Node body;
            string buf;
            Out output = new OutImpl();

            body = root.FindBody(lexer.Options.tt);
            count = CountSlides(body);
            slidecontent = body.Content;
            AddTransitionEffect(lexer, root, EFFECT_BLEND, 3.0);

            for (slide = 1; slide <= count; ++slide)
            {
                buf = "slide" + slide + ".html";
                output.State = StreamIn.FSM_ASCII;
                output.Encoding = _options.CharEncoding;

                try
                {
                    output.Output = new FileStream(buf, FileMode.Create);
                    PrintTree(output, (short) 0, 0, lexer, root);
                    FlushLine(output, 0);
                    output.Output.Close();
                }
                catch (IOException e)
                {
                    Console.Error.WriteLine(buf + e.ToString());
                }
            }

            /*
            delete superfluous slides by deleting slideN.html
            for N = count+1, count+2, etc. until no such file
            is found.
            */

            for (;;)
            {
                buf = "slide" + slide + "html";

                bool tmpBool;
                if (File.Exists((new FileInfo(buf)).FullName))
                {
                    File.Delete((new FileInfo(buf)).FullName);
                    tmpBool = true;
                }
                else if (Directory.Exists((new FileInfo(buf)).FullName))
                {
                    Directory.Delete((new FileInfo(buf)).FullName);
                    tmpBool = true;
                }
                else
                {
                    tmpBool = false;
                }
                if (!tmpBool)
                {
                    break;
                }

                ++slide;
            }
        }
开发者ID:bgarrels,项目名称:betterpoeditor,代码行数:63,代码来源:PPrint.cs


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