示例#1
0
文件: Tag.cs 项目: raihansazal/Eighty
        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('>');
        }
示例#2
0
 internal override void WriteImpl(ref HtmlEncodingTextWriter writer)
 {
     foreach (var child in _children)
     {
         child.WriteImpl(ref writer);
     }
 }
示例#3
0
        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);
        }
示例#4
0
        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("/>");
        }
示例#5
0
        /// <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);
        }
示例#6
0
 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('"');
         }
     }
 }
示例#7
0
 internal abstract void WriteImpl(ref HtmlEncodingTextWriter writer);
示例#8
0
 internal override void WriteImpl(ref HtmlEncodingTextWriter writer)
 {
     writer.Write(_text);
 }
示例#9
0
文件: Raw.cs 项目: raihansazal/Eighty
 internal override void WriteImpl(ref HtmlEncodingTextWriter writer)
 {
     writer.WriteRaw(_rawHtml);
 }