本文整理匯總了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;
}
}