本文整理汇总了C#中TidyNet.Node.HasOneChild方法的典型用法代码示例。如果您正苦于以下问题:C# Node.HasOneChild方法的具体用法?C# Node.HasOneChild怎么用?C# Node.HasOneChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TidyNet.Node
的用法示例。
在下文中一共展示了Node.HasOneChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BQ2Div
/*
Replace implicit blockquote by div with an indent
taking care to reduce nested blockquotes to a single
div with the indent set to match the nesting depth
*/
public virtual void BQ2Div(Node node)
{
int indent;
string indent_buf;
while (node != null)
{
if (node.Tag == _tt.TagBlockquote && node.Isimplicit)
{
indent = 1;
while (node.HasOneChild() && node.Content.Tag == _tt.TagBlockquote && node.Isimplicit)
{
++indent;
StripOnlyChild(node);
}
if (node.Content != null)
{
BQ2Div(node.Content);
}
indent_buf = "margin-left: " + (2 * indent).ToString() + "em";
node.Element = _tt.TagDiv.Name;
node.Tag = _tt.TagDiv;
node.AddAttribute("style", indent_buf);
}
else if (node.Content != null)
{
BQ2Div(node.Content);
}
node = node.Next;
}
}
示例2: List2BQ
/*
Some people use dir or ul without an li
to indent the content. The pattern to
look for is a list with a single implicit
li. This is recursively replaced by an
implicit blockquote.
*/
public virtual void List2BQ(Node node)
{
while (node != null)
{
if (node.Content != null)
{
List2BQ(node.Content);
}
if (node.Tag != null && node.Tag.Parser == ParserImpl.ParseList && node.HasOneChild() && node.Content.Isimplicit)
{
StripOnlyChild(node);
node.Element = _tt.TagBlockquote.Name;
node.Tag = _tt.TagBlockquote;
node.Isimplicit = true;
}
node = node.Next;
}
}