本文整理匯總了C#中TidyNet.Lexer.NewLineNode方法的典型用法代碼示例。如果您正苦於以下問題:C# Lexer.NewLineNode方法的具體用法?C# Lexer.NewLineNode怎麽用?C# Lexer.NewLineNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TidyNet.Lexer
的用法示例。
在下文中一共展示了Lexer.NewLineNode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CleanWord2000
/*
This is a major clean up to strip out all the extra stuff you get
when you save as web page from Word 2000. It doesn't yet know what
to do with VML tags, but these will appear as errors unless you
declare them as new tags, such as o:p which needs to be declared
as inline.
*/
public virtual void CleanWord2000(Lexer lexer, Node node)
{
/* used to a list from a sequence of bulletted p's */
Node list = null;
while (node != null)
{
/* discard Word's style verbiage */
if (node.Tag == _tt.TagStyle || node.Tag == _tt.TagMeta || node.Type == Node.CommentTag)
{
node = Node.DiscardElement(node);
continue;
}
/* strip out all span tags Word scatters so liberally! */
if (node.Tag == _tt.TagSpan)
{
node = StripSpan(lexer, node);
continue;
}
/* get rid of Word's xmlns attributes */
if (node.Tag == _tt.TagHtml)
{
/* check that it's a Word 2000 document */
if (node.GetAttrByName("xmlns:o") == null)
{
return;
}
}
if (node.Tag == _tt.TagLink)
{
AttVal attr = node.GetAttrByName("rel");
if (attr != null && attr.Val != null && attr.Val.Equals("File-List"))
{
node = Node.DiscardElement(node);
continue;
}
}
/* discard empty paragraphs */
if (node.Content == null && node.Tag == _tt.TagP)
{
node = Node.DiscardElement(node);
continue;
}
if (node.Tag == _tt.TagP)
{
AttVal attr = node.GetAttrByName("class");
/* map sequence of <p class="MsoListBullet"> to <ul>...</ul> */
if (attr != null && attr.Val != null && attr.Val.Equals("MsoListBullet"))
{
Node.CoerceNode(lexer, node, _tt.TagLi);
if (list == null || list.Tag != _tt.TagUl)
{
list = lexer.InferredTag("ul");
Node.InsertNodeBeforeElement(node, list);
}
PurgeAttributes(node);
if (node.Content != null)
{
CleanWord2000(lexer, node.Content);
}
/* remove node and append to contents of list */
Node.RemoveNode(node);
Node.InsertNodeAtEnd(list, node);
node = list.Next;
}
else if (attr != null && attr.Val != null && attr.Val.Equals("Code"))
{
/* map sequence of <p class="Code"> to <pre>...</pre> */
Node br = lexer.NewLineNode();
NormalizeSpaces(lexer, node);
if (list == null || list.Tag != _tt.TagPre)
{
list = lexer.InferredTag("pre");
Node.InsertNodeBeforeElement(node, list);
}
/* remove node and append to contents of list */
Node.RemoveNode(node);
Node.InsertNodeAtEnd(list, node);
StripSpan(lexer, node);
Node.InsertNodeAtEnd(list, br);
//.........這裏部分代碼省略.........