internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { writer.WriteRaw('<'); if (_shouldEncodeName) { writer.Write(_tagName); } else { writer.WriteRaw(_tagName); } foreach (var attr in _attributes) { writer.WriteRaw(' '); attr.Write(ref writer); } writer.WriteRaw('>'); foreach (var child in _children) { child.WriteImpl(ref writer); } writer.WriteRaw("</"); writer.Write(_tagName); writer.WriteRaw('>'); }
internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { foreach (var child in _children) { child.WriteImpl(ref writer); } }
internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { var builder = _builderFactory(); if (builder == null) { throw new InvalidOperationException("Builder factory cannot return null"); } builder.WritePartial(ref writer); }
internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { writer.WriteRaw('<'); if (_shouldEncodeName) { writer.Write(_name); } else { writer.WriteRaw(_name); } foreach (var attr in _attributes) { writer.WriteRaw(' '); attr.Write(ref writer); } writer.WriteRaw("/>"); }
/// <summary> /// Write the HTML to a <see cref="TextWriter"/>, using an <see cref="HtmlEncoder"/> to encode input text /// </summary> /// <param name="writer">The writer</param> /// <param name="htmlEncoder">The HTML encoder</param> public unsafe void Write(TextWriter writer, HtmlEncoder htmlEncoder) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (htmlEncoder == null) { throw new ArgumentNullException(nameof(htmlEncoder)); } var buffer = ArrayPool <char> .Shared.Rent(4096); fixed(char *start = buffer) { var htmlEncodingTextWriter = new HtmlEncodingTextWriter(writer, htmlEncoder, buffer, start, buffer.Length); WriteImpl(ref htmlEncodingTextWriter); htmlEncodingTextWriter.Flush(); } ArrayPool <char> .Shared.Return(buffer); }
internal void Write(ref HtmlEncodingTextWriter writer) { if (_shouldEncode) { writer.Write(_name); if (_value != null) { writer.WriteRaw("=\""); writer.Write(_value); writer.WriteRaw('"'); } } else { writer.WriteRaw(_name); if (_value != null) { writer.WriteRaw("=\""); writer.WriteRaw(_value); writer.WriteRaw('"'); } } }
internal abstract void WriteImpl(ref HtmlEncodingTextWriter writer);
internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { writer.Write(_text); }
internal override void WriteImpl(ref HtmlEncodingTextWriter writer) { writer.WriteRaw(_rawHtml); }