/* Replace implicit blockquote by div with an indent taking care to reduce nested blockquotes to a single div with the indent set to match the nesting depth */ public virtual void BQ2Div(Node node) { int indent; string indent_buf; while (node != null) { if (node.Tag == _tt.TagBlockquote && node.Isimplicit) { indent = 1; while (node.HasOneChild() && node.Content.Tag == _tt.TagBlockquote && node.Isimplicit) { ++indent; StripOnlyChild(node); } if (node.Content != null) { BQ2Div(node.Content); } indent_buf = "margin-left: " + (2 * indent).ToString() + "em"; node.Element = _tt.TagDiv.Name; node.Tag = _tt.TagDiv; node.AddAttribute("style", indent_buf); } else if (node.Content != null) { BQ2Div(node.Content); } node = node.Next; } }
/* Some people use dir or ul without an li to indent the content. The pattern to look for is a list with a single implicit li. This is recursively replaced by an implicit blockquote. */ public virtual void List2BQ(Node node) { while (node != null) { if (node.Content != null) { List2BQ(node.Content); } if (node.Tag != null && node.Tag.Parser == ParserImpl.ParseList && node.HasOneChild() && node.Content.Isimplicit) { StripOnlyChild(node); node.Element = _tt.TagBlockquote.Name; node.Tag = _tt.TagBlockquote; node.Isimplicit = true; } node = node.Next; } }