Пример #1
0
 protected override void WriteText(TextWriter result, string value)
 {
     if (TopTag != null)
     {
         switch (TopTag.ToLowerInvariant())
         {
         case "pre":
             string text = RewritePreText(RequiredHtmlEncode ? value.HtmlEncode() : value);
             result.Write(text);
             return;
         }
     }
     base.WriteText(result, value);
 }
Пример #2
0
        protected override void WriteText(TextWriter result, string value)
        {
            if (_prevNodeType == HtmlNodeType.Element && !string.IsNullOrEmpty(value))
            {
                value = value.TrimStart(new[] { '\r', '\n' });
            }

            if (TopTag != null)
            {
                switch (TopTag.ToLowerInvariant())
                {
                case "pre":
                    string text = RewritePreText(RequiredHtmlEncode ? value.HtmlEncode() : value);
                    _prevNodeType = HtmlNodeType.Text;
                    result.Write(text);
                    return;
                }
            }

            _prevNodeType = HtmlNodeType.Text;
            base.WriteText(result, value);
        }