本文整理汇总了C#中Tidy.Core.Node.FindBody方法的典型用法代码示例。如果您正苦于以下问题:C# Node.FindBody方法的具体用法?C# Node.FindBody怎么用?C# Node.FindBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tidy.Core.Node
的用法示例。
在下文中一共展示了Node.FindBody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NiceBody
private bool NiceBody(Lexer lexer, Node doc)
{
Node body = doc.FindBody(lexer.Options.TagTable);
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;
}
示例2: CreateSlides
public virtual void CreateSlides(Lexer lexer, Node root)
{
Out output = new OutImpl();
Node body = root.FindBody(lexer.Options.TagTable);
_count = CountSlides(body);
_slidecontent = body.Content;
AddTransitionEffect(lexer, root, EFFECT_BLEND, 3.0);
for (_slide = 1; _slide <= _count; ++_slide)
{
string buf = "slide" + _slide + ".html";
output.State = StreamIn.FSM_ASCII;
output.Encoding = _options.CharEncoding;
try
{
output.Output = new MemoryStream();
PrintTree(output, 0, 0, lexer, root);
FlushLine(output, 0);
}
catch (IOException e)
{
Debug.WriteLine(buf + e);
}
}
}
示例3: CreateStyleElement
/* create style element using rules from dictionary */
private void CreateStyleElement(Lexer lexer, Node doc)
{
Style style;
if (lexer.Styles == null && NiceBody(lexer, doc))
{
return;
}
Node node = lexer.NewNode(Node.START_TAG, null, 0, 0, "style");
node.Isimplicit = true;
/* insert type attribute */
var av = new AttVal(null, null, '"', "type", "text/css");
av.Dict = AttributeTable.DefaultAttributeTable.FindAttribute(av);
node.Attributes = av;
Node body = doc.FindBody(lexer.Options.TagTable);
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.TEXT_NODE, 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
*/
Node head = doc.FindHead(lexer.Options.TagTable);
if (head != null)
{
Node.InsertNodeAtEnd(head, node);
}
}