예제 #1
0
 protected virtual string AppendElementNode(string text, ParsedElement element)
 {
     if (element.StartTag.Equals("<ul>", StringComparison.InvariantCultureIgnoreCase))
     {
         return(ListTagsFormatter.AppendUnorderedList(text, element, this));
     }
     else if (element.StartTag.Equals("<ol>", StringComparison.InvariantCultureIgnoreCase))
     {
         return(ListTagsFormatter.AppendOrderedList(text, element, this));
     }
     else if (element.StartTag.StartsWith("<a ", StringComparison.InvariantCultureIgnoreCase))
     {
         return(UrlTagsFormatter.AppendUrlTag(text, element, this));
     }
     else if (element.StartTag.Equals("<hr>", StringComparison.InvariantCultureIgnoreCase))
     {
         return(HorizontalRuleTagsFormatter.AppendHorizontalRule(text, element, this));
     }
     else if (element.StartTag.Equals("<noparse>", StringComparison.InvariantCultureIgnoreCase))
     {
         return(text + element.ToString());
     }
     else
     {
         return(AppendGenericElementNode(text, element));
     }
 }
예제 #2
0
        public virtual string AppendUnorderedList(string text, ParsedElement element, IChildTagsFormatter childTagsFormatter)
        {
            UnorderedIndentLevel++;
            text = AppendListStart(text);
            text = AppendUnorderedListChildren(text, element.Children, childTagsFormatter);
            text = AppendListEnd(text);
            UnorderedIndentLevel--;

            return(text);
        }
예제 #3
0
 protected virtual string GetOrderedListItemText(int index, ParsedElement element, IChildTagsFormatter childTagsFormatter)
 => "\n" + GetOrderedListItemStart(index++) + GetIndentOpeningTag()
 + childTagsFormatter.FormatChildren(element.Children).Trim() + IndentClosingTag;
예제 #4
0
 protected virtual string GetUnorderedListItemText(char bulletChar, ParsedElement element, IChildTagsFormatter childTagsFormatter)
 => "\n" + bulletChar + GetIndentOpeningTag()
 + childTagsFormatter.FormatChildren(element.Children).Trim() + IndentClosingTag;
예제 #5
0
 protected virtual string AppendGenericElementNode(string text, ParsedElement element)
 => $"{text}{element.StartTag}{AppendChildren("", element.Children)}{element.EndTag}";