本文整理汇总了C#中Tidy.Core.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于Tidy.Core命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Check
public virtual void Check(Lexer lexer, Node node)
{
node.CheckUniqueAttributes(lexer);
AttVal lang = node.GetAttrByName("language");
AttVal type = node.GetAttrByName("type");
if (type == null)
{
Report.AttrError(lexer, node, "type", Report.MISSING_ATTRIBUTE);
/* check for javascript */
if (lang != null)
{
string str = lang.Val;
if (str.Length > 10)
{
str = str.Substring(0, 10);
}
if ((String.CompareOrdinal(str, "javascript") == 0) || (String.CompareOrdinal(str, "jscript") == 0))
{
node.AddAttribute("type", "text/javascript");
}
}
else
{
node.AddAttribute("type", "text/javascript");
}
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:30,代码来源:ScriptCheckAttribs.cs
示例2: 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)
{
while (node != null)
{
if (node.Tag == _tt.TagBlockquote && node.Isimplicit)
{
int indent = 1;
while (node.HasOneChild() && node.Content.Tag == _tt.TagBlockquote && node.Isimplicit)
{
++indent;
StripOnlyChild(node);
}
if (node.Content != null)
{
Bq2Div(node.Content);
}
string indentBuf = "margin-left: " + (2*indent).ToString() + "em";
node.Element = _tt.TagDiv.Name;
node.Tag = _tt.TagDiv;
node.AddAttribute("style", indentBuf);
}
else if (node.Content != null)
{
Bq2Div(node.Content);
}
node = node.Next;
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:38,代码来源:Clean.cs
示例3: PreTraverse
protected internal virtual void PreTraverse(Node node)
{
if (node == null)
{
return;
}
if (node.Type == Node.START_TAG || node.Type == Node.START_END_TAG)
{
if (_currIndex <= _maxIndex && (_tagName.Equals("*") || _tagName.Equals(node.Element)))
{
_currIndex += 1;
_currNode = node;
}
}
if (_currIndex > _maxIndex)
{
return;
}
node = node.Content;
while (node != null)
{
PreTraverse(node);
node = node.Next;
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:27,代码来源:DomNodeListByTagNameImpl.cs
示例4: Check
public virtual void Check(Lexer lexer, Node node)
{
AttVal attval;
string val = null;
node.CheckUniqueAttributes(lexer);
for (attval = node.Attributes; attval != null; attval = attval.Next)
{
if (String.CompareOrdinal(attval.Attribute, "align") == 0)
{
val = attval.Val;
break;
}
}
if (val != null)
{
if (String.CompareOrdinal(val, "left") == 0 || String.CompareOrdinal(val, "right") == 0)
{
lexer.Versions &= HtmlVersion.Html40Loose | HtmlVersion.Frames;
}
else if (String.CompareOrdinal(val, "top") == 0 || String.CompareOrdinal(val, "bottom") == 0)
{
lexer.Versions &= HtmlVersion.From32;
}
else
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:32,代码来源:CaptionCheckTableCheckAttribs.cs
示例5: Check
public virtual void Check(Lexer lexer, Node node, AttVal attval)
{
string val = attval.Val;
if (val == null)
{
Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
}
else if (String.CompareOrdinal(val, "top") == 0 || String.CompareOrdinal(val, "middle") == 0 ||
String.CompareOrdinal(val, "bottom") == 0 || String.CompareOrdinal(val, "baseline") == 0)
{
/* all is fine */
}
else if (String.CompareOrdinal(val, "left") == 0 || String.CompareOrdinal(val, "right") == 0)
{
if (!(node.Tag != null && ((node.Tag.Model & ContentModel.IMG) != 0)))
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
else if (String.CompareOrdinal(val, "texttop") == 0 || String.CompareOrdinal(val, "absmiddle") == 0 ||
String.CompareOrdinal(val, "absbottom") == 0 || String.CompareOrdinal(val, "textbottom") == 0)
{
lexer.Versions &= HtmlVersion.Proprietary;
Report.AttrError(lexer, node, val, Report.PROPRIETARY_ATTR_VALUE);
}
else
{
Report.AttrError(lexer, node, val, Report.BAD_ATTRIBUTE_VALUE);
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:31,代码来源:ValignAttrCheck.cs
示例6: AttVal
public AttVal(AttVal next, Attribute dict, Node asp, Node php, int delim, string attribute, string val)
{
Next = next;
_dict = dict;
_asp = asp;
Php = php;
Delim = delim;
Attribute = attribute;
Val = val;
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:10,代码来源:AttVal.cs
示例7: Check
public virtual void Check(Lexer lexer, Node node, AttVal attval)
{
/* IMG, OBJECT, APPLET and EMBED use align for vertical position */
if (node.Tag != null && ((node.Tag.Model & ContentModel.IMG) != 0))
{
AttrCheckImpl.CheckValign.Check(lexer, node, attval);
return;
}
string val = attval.Val;
if (val == null)
{
Report.AttrError(lexer, node, attval.Attribute, Report.MISSING_ATTR_VALUE);
}
else if (
!(String.CompareOrdinal(val, "left") == 0 || String.CompareOrdinal(val, "center") == 0 ||
String.CompareOrdinal(val, "right") == 0 || String.CompareOrdinal(val, "justify") == 0))
{
Report.AttrError(lexer, node, attval.Val, Report.BAD_ATTRIBUTE_VALUE);
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:22,代码来源:AlignAttrCheck.cs
示例8: DomElementImpl
protected internal DomElementImpl(Node adaptee)
: base(adaptee)
{
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:4,代码来源:DomElementImpl.cs
示例9: PrintSlide
/*
Called from printTree to print the content of a slide from
the node slidecontent. On return slidecontent points to the
node starting the next slide or null. The variables slide
and count are used to customise the navigation bar.
*/
public virtual void PrintSlide(Out fout, int mode, int indent, Lexer lexer)
{
TagCollection tt = _options.TagTable;
/* insert div for onclick handler */
string s = "<div onclick=\"document.location='slide" + (_slide < _count ? _slide + 1 : 1).ToString() +
".html'\">";
PrintString(s);
CondFlushLine(fout, indent);
/* first print the h2 element and navbar */
if (_slidecontent.Tag == tt.TagH2)
{
PrintNavBar(fout, indent);
/* now print an hr after h2 */
AddC('<', _linelen++);
AddC(Lexer.FoldCase('h', _options.UpperCaseTags, _options.XmlTags), _linelen++);
AddC(Lexer.FoldCase('r', _options.UpperCaseTags, _options.XmlTags), _linelen++);
if (_options.XmlOut)
{
PrintString(" />");
}
else
{
AddC('>', _linelen++);
}
if (_options.IndentContent)
{
CondFlushLine(fout, indent);
}
/* PrintVertSpacer(fout, indent); */
/*CondFlushLine(fout, indent); */
/* print the h2 element */
PrintTree(fout, mode, (_options.IndentContent ? indent + _options.Spaces : indent), lexer, _slidecontent);
_slidecontent = _slidecontent.Next;
}
/* now continue until we reach the next h2 */
Node last = null;
Node content = _slidecontent;
for (; content != null; content = content.Next)
{
if (content.Tag == tt.TagH2)
{
break;
}
/* kludge for naked text before block level tag */
if (last != null && !_options.IndentContent && last.Type == Node.TEXT_NODE && content.Tag != null &&
(content.Tag.Model & ContentModel.BLOCK) != 0)
{
FlushLine(fout, indent);
FlushLine(fout, indent);
}
PrintTree(fout, mode, (_options.IndentContent ? indent + _options.Spaces : indent), lexer, content);
last = content;
}
_slidecontent = content;
/* now print epilog */
CondFlushLine(fout, indent);
PrintString("<br clear=\"all\">");
CondFlushLine(fout, indent);
AddC('<', _linelen++);
AddC(Lexer.FoldCase('h', _options.UpperCaseTags, _options.XmlTags), _linelen++);
AddC(Lexer.FoldCase('r', _options.UpperCaseTags, _options.XmlTags), _linelen++);
if (_options.XmlOut)
{
PrintString(" />");
}
else
{
AddC('>', _linelen++);
}
//.........这里部分代码省略.........
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:101,代码来源:PPrint.cs
示例10: DomNodeListByTagNameImpl
protected internal DomNodeListByTagNameImpl(Node first, string tagName)
{
_first = first;
_tagName = tagName;
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:5,代码来源:DomNodeListByTagNameImpl.cs
示例11: PrintPi
private void PrintPi(Out fout, int indent, Node node)
{
if (indent + _linelen < _options.WrapLen)
{
_wraphere = _linelen;
}
AddC('<', _linelen++);
AddC('?', _linelen++);
/* set CDATA to pass < and > unescaped */
PrintText(fout, CDATA, indent, node.Textarray, node.Start, node.End);
if (node.Textarray[node.End - 1] != (byte) '?')
{
AddC('?', _linelen++);
}
AddC('>', _linelen++);
CondFlushLine(fout, indent);
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:21,代码来源:PPrint.cs
示例12: PrintAttrs
private void PrintAttrs(Out fout, int indent, Node node, AttVal attr)
{
if (attr != null)
{
if (attr.Next != null)
{
PrintAttrs(fout, indent, node, attr.Next);
}
if (attr.Attribute != null)
{
PrintAttribute(fout, indent, node, attr);
}
else if (attr.Asp != null)
{
AddC(' ', _linelen++);
PrintAsp(fout, indent, attr.Asp);
}
else if (attr.Php != null)
{
AddC(' ', _linelen++);
PrintPhp(fout, indent, attr.Php);
}
}
/* add xml:space attribute to pre and other elements */
if (_options.XmlOut && _options.XmlSpace && ParserImpl.XmlPreserveWhiteSpace(node, _options.TagTable) &&
node.GetAttrByName("xml:space") == null)
{
PrintString(" xml:space=\"preserve\"");
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:32,代码来源:PPrint.cs
示例13: PrintTag
private void PrintTag(Lexer lexer, Out fout, int mode, int indent, Node node)
{
TagCollection tt = _options.TagTable;
AddC('<', _linelen++);
if (node.Type == Node.END_TAG)
{
AddC('/', _linelen++);
}
string p = node.Element;
for (int i = 0; i < p.Length; i++)
{
AddC(Lexer.FoldCase(p[i], _options.UpperCaseTags, _options.XmlTags), _linelen++);
}
PrintAttrs(fout, indent, node, node.Attributes);
if ((_options.XmlOut || lexer != null && lexer.Isvoyager) &&
(node.Type == Node.START_END_TAG || (node.Tag.Model & ContentModel.EMPTY) != 0))
{
AddC(' ', _linelen++); /* compatibility hack */
AddC('/', _linelen++);
}
AddC('>', _linelen++);
if (node.Type == Node.START_END_TAG || (mode & PREFORMATTED) != 0) return;
if (indent + _linelen >= _options.WrapLen)
{
WrapLine(fout, indent);
}
if (indent + _linelen < _options.WrapLen)
{
/*
wrap after start tag if is <br/> or if it's not
inline or it is an empty tag followed by </a>
*/
if (AfterSpace(node))
{
if ((mode & NOWRAP) == 0 &&
((node.Tag.Model & ContentModel.INLINE) == 0 || (node.Tag == tt.TagBr) ||
(((node.Tag.Model & ContentModel.EMPTY) != 0) && node.Next == null &&
node.Parent.Tag == tt.TagA)))
{
_wraphere = _linelen;
}
}
}
else
{
CondFlushLine(fout, indent);
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:56,代码来源:PPrint.cs
示例14: PrintAsp
/* note ASP and JSTE share <% ... %> syntax */
private void PrintAsp(Out fout, int indent, Node node)
{
int savewraplen = _options.WrapLen;
/* disable wrapping if so requested */
if (!_options.WrapAsp || !_options.WrapJste)
{
_options.WrapLen = 0xFFFFFF;
}
/* a very large number */
AddC('<', _linelen++);
AddC('%', _linelen++);
PrintText(fout, (_options.WrapAsp ? CDATA : COMMENT), indent, node.Textarray, node.Start, node.End);
AddC('%', _linelen++);
AddC('>', _linelen++);
/* CondFlushLine(fout, indent); */
_options.WrapLen = savewraplen;
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:24,代码来源:PPrint.cs
示例15: PrintAttribute
private void PrintAttribute(Out fout, int indent, Node node, AttVal attr)
{
bool wrappable = false;
if (_options.IndentAttributes)
{
FlushLine(fout, indent);
indent += _options.Spaces;
}
string name = attr.Attribute;
if (indent + _linelen >= _options.WrapLen)
{
WrapLine(fout, indent);
}
if (!_options.XmlTags && !_options.XmlOut && attr.Dict != null)
{
if (AttributeTable.DefaultAttributeTable.IsScript(name))
{
wrappable = _options.WrapScriptlets;
}
else if (!attr.Dict.Nowrap && _options.WrapAttVals)
{
wrappable = true;
}
}
if (indent + _linelen < _options.WrapLen)
{
_wraphere = _linelen;
AddC(' ', _linelen++);
}
else
{
CondFlushLine(fout, indent);
AddC(' ', _linelen++);
}
for (int i = 0; i < name.Length; i++)
{
AddC(Lexer.FoldCase(name[i], _options.UpperCaseAttrs, _options.XmlTags), _linelen++);
}
if (indent + _linelen >= _options.WrapLen)
{
WrapLine(fout, indent);
}
if (attr.Val == null)
{
if (_options.XmlTags || _options.XmlOut)
{
PrintAttrValue(fout, indent, attr.Attribute, attr.Delim, true);
}
else if (!attr.BoolAttribute && !Node.IsNewNode(node))
{
PrintAttrValue(fout, indent, "", attr.Delim, true);
}
else if (indent + _linelen < _options.WrapLen)
{
_wraphere = _linelen;
}
}
else
{
PrintAttrValue(fout, indent, attr.Val, attr.Delim, wrappable);
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:70,代码来源:PPrint.cs
示例16: DomDocumentImpl
protected internal DomDocumentImpl(Node adaptee)
: base(adaptee)
{
_tt = new TagCollection();
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:5,代码来源:DomDocumentImpl.cs
示例17: ShouldIndent
private bool ShouldIndent(Node node)
{
TagCollection tt = _options.TagTable;
if (!_options.IndentContent)
return false;
if (_options.SmartIndent)
{
if (node.Content != null && ((node.Tag.Model & ContentModel.NO_INDENT) != 0))
{
for (node = node.Content; node != null; node = node.Next)
{
if (node.Tag != null && (node.Tag.Model & ContentModel.BLOCK) != 0)
{
return true;
}
}
return false;
}
if ((node.Tag.Model & ContentModel.HEADING) != 0)
{
return false;
}
if (node.Tag == tt.TagP)
{
return false;
}
if (node.Tag == tt.TagTitle)
{
return false;
}
}
if ((node.Tag.Model & (ContentModel.FIELD | ContentModel.OBJECT)) != 0)
{
return true;
}
if (node.Tag == tt.TagMap)
{
return true;
}
return (node.Tag.Model & ContentModel.INLINE) == 0;
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:50,代码来源:PPrint.cs
示例18: CreateElement
public virtual IElement CreateElement(string tagName)
{
var node = new Node(Node.START_END_TAG, null, 0, 0, tagName, _tt);
if (node.Tag == null)
node.Tag = _tt.XmlTags;
return (IElement) node.Adapter;
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:8,代码来源:DomDocumentImpl.cs
示例19: DomProcessingInstructionImpl
protected internal DomProcessingInstructionImpl(Node adaptee)
: base(adaptee)
{
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:4,代码来源:DomProcessingInstructionImpl.cs
示例20: 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);
}
}
}
开发者ID:r1pper,项目名称:TidyNetPortable,代码行数:27,代码来源:PPrint.cs
注:本文中的Tidy.Core.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论