Esempio n. 1
0
        public override void OuterHtmlHead(StringBuilder accum, int depth, OutputSettings output)
        {
            string html = Entities.Escape(GetWholeText(), output);

            if (output.PrettyPrint() && ParentNode is Element && !((Element)ParentNode).PreserveWhitespace)
            {
                html = NormaliseWhitespace(html);
            }

            if (output.PrettyPrint() && SiblingIndex == 0 && ParentNode is Element && ((Element)ParentNode).Tag.FormatAsBlock && !IsBlank)
            {
                Indent(accum, depth, output);
            }
            accum.Append(html);
        }
Esempio n. 2
0
 public override void OuterHtmlTail(StringBuilder accum, int depth, OutputSettings output)
 {
     if (!(ChildNodes.Count == 0 && Tag.IsSelfClosing))
     {
         if (output.PrettyPrint() && ChildNodes.Count != 0 && Tag.FormatAsBlock)
         {
             Indent(accum, depth, output);
         }
         accum.Append("</").Append(TagOriginalName()).Append(">");
     }
 }
Esempio n. 3
0
        public object Clone()
        {
            OutputSettings clone = new OutputSettings();

            clone.SetEncoding(_encoding.WebName); // new charset and charset encoder
            clone.EscapeMode = _escapeMode;
            clone.PrettyPrint(_prettyPrint);
            clone.IndentAmount(_indentAmount);

            return(clone);
        }
Esempio n. 4
0
        public override void OuterHtmlHead(StringBuilder accum, int depth, OutputSettings output)
        {
            if (output.PrettyPrint())
            {
                Indent(accum, depth, output);
            }

            accum
            .Append("<!--")
            .Append(GetData())
            .Append("-->");
        }
Esempio n. 5
0
        public override void OuterHtmlHead(StringBuilder accum, int depth, OutputSettings output)
        {
            if (accum.Length > 0 && output.PrettyPrint() && (Tag.FormatAsBlock || (Parent != null && Parent.Tag.FormatAsBlock)))
            {
                Indent(accum, depth, output);
            }

            accum.Append("<")
            .Append(TagOriginalName());
            Attributes.HtmlOriginal(accum, output);

            if (ChildNodes.Count <= 0 && _tag.IsSelfClosing)
            {
                accum.Append(" />");
            }
            else
            {
                accum.Append(">");
            }
        }