public HtmlElementPrinter(String tagName, int stackDepth, HtmlElementPrinter parentElementPrinter) { this.tagName = tagName; this.stackDepth = stackDepth; this.parentElementPrinter = parentElementPrinter; //create the appropriate indentation strategy for this element this.indentStrategy = CreateIndentStrategy(tagName, this); }
public BlockElementIndentStrategy(HtmlElementPrinter elementPrinter) : base(elementPrinter) { //if this element is is the very first content in the parent element, then suppress //adding the visual line break so that we don't end up with extra whitespace. HtmlElementPrinter parent = elementPrinter.getParent(); if (parent != null) { forceVisualLeadingLineBreak = parent.ChildCount > 0; } }
public void WriteStartElement(String name) { HtmlElementPrinter currentPrinter = null; if (openElements.Count > 0) { currentPrinter = GetCurrentElementPrinter(); } HtmlElementPrinter elementPrinter = new HtmlElementPrinter(name, openElements.Count, currentPrinter); if (currentPrinter != null) { currentPrinter.BeforeAddChildElement(sb, name); } elementPrinter.WriteElementStart(sb); openElements.Push(elementPrinter); }
public ElementIndentStrategy(HtmlElementPrinter elementPrinter) { this.elementPrinter = elementPrinter; }
private static ElementIndentStrategy CreateIndentStrategy(String tagName, HtmlElementPrinter printer) { if (BlockTagNames.ContainsKey(tagName)) { return(new BlockElementIndentStrategy(printer)); } else { return(new ElementIndentStrategy(printer)); } }
public void WriteEndElement(bool requiresEndTag) { HtmlElementPrinter elementPrinter = (HtmlElementPrinter)openElements.Pop(); elementPrinter.WriteElementEnd(sb, requiresEndTag); }
public BlockElementIndentStrategy(HtmlElementPrinter elementPrinter) : base(elementPrinter) { //if this element is is the very first content in the parent element, then supress //adding the visual line break so that we don't end up with extra whitespace. HtmlElementPrinter parent = elementPrinter.getParent(); if (parent != null) forceVisualLeadingLineBreak = parent.ChildCount > 0; }
private static ElementIndentStrategy CreateIndentStrategy(String tagName, HtmlElementPrinter printer) { if (BlockTagNames.ContainsKey(tagName)) return new BlockElementIndentStrategy(printer); else return new ElementIndentStrategy(printer); }
public HtmlElementPrinter(String tagName, int stackDepth, HtmlElementPrinter parentElementPrinter) { this.tagName = tagName; this.stackDepth = stackDepth; this.parentElementPrinter = parentElementPrinter; //create the appropriate indentation stategy for this element this.indentStrategy = CreateIndentStrategy(tagName, this); }
public void WriteStartElement(String name) { HtmlElementPrinter currentPrinter = null; if (openElements.Count > 0) { currentPrinter = GetCurrentElementPrinter(); } HtmlElementPrinter elementPrinter = new HtmlElementPrinter(name, openElements.Count, currentPrinter); if (currentPrinter != null) currentPrinter.BeforeAddChildElement(sb, name); elementPrinter.WriteElementStart(sb); openElements.Push(elementPrinter); }