示例#1
0
        protected override void Write(HtmlDOCTYPE node)
        {
            if (ShouldPretty())
            {
                writer.WriteLine();
                this.WriteIndent();
            }

            base.Write(node);
        }
示例#2
0
        void TryProcessDoctype()
        {
            // We are noy fully parsing a DOCTYPE so we just expect that
            // there won't be any ">" inside a double quote string
            tempBuilder.Clear();
            if (TryParse("DOCTYPE", false, tempBuilder))
            {
                if (char.IsWhiteSpace(c) || c == '>')
                {
                    while (true)
                    {
                        if (c == 0)
                        {
                            goto onerror;
                        }
                        if (c == '>')
                        {
                            c = NextChar();
                            break;
                        }

                        c = NextChar();
                    }

                    var tag = new HtmlDOCTYPE
                    {
                        Location = startTagLocation,
                        Slice    = new StringSlice(text, startTagLocation.Position, position - 1)
                    };
                    CurrentParent.AppendChild(tag);
                    return;
                }
            }

onerror:

            Error(c == 0
                ? $"Invalid EOF found while parsing <!DOCTYPE"
                : $"Invalid character '{c}' found while parsing <!DOCTYPE");

            AppendText(startTagLocation, position - 1);
        }
示例#3
0
 protected override void Write(HtmlDOCTYPE node)
 {
 }
示例#4
0
 protected virtual void Write(HtmlDOCTYPE node)
 {
     // It is parsed as a raw type
     Write(node.Slice.ToString());
 }
示例#5
0
 protected override void Write(HtmlDOCTYPE node)
 {
     Start("!doc");
     base.Write(node);
     FlushDOM();
 }