protected override void Write(HtmlDOCTYPE node) { if (ShouldPretty()) { writer.WriteLine(); this.WriteIndent(); } base.Write(node); }
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); }
protected override void Write(HtmlDOCTYPE node) { }
protected virtual void Write(HtmlDOCTYPE node) { // It is parsed as a raw type Write(node.Slice.ToString()); }
protected override void Write(HtmlDOCTYPE node) { Start("!doc"); base.Write(node); FlushDOM(); }