protected override void WriteElement(DomElement element) { var frag = element as HxlElement; if (frag != null) { WriteElementFragment(frag); return; } // TODO Missing HTML settings and pretty print semantics IHxlElementTemplate template = HxlElementTemplate.ProcessAttributesForTemplate(element, TemplateContext); template = template ?? element.GetElementTemplate() ?? HxlElementTemplate.Default; template.Render(element, this); }
internal static void Render(DomElement element, string name, string layoutName, HxlWriter hxlOutput) { var templateContext = hxlOutput.TemplateContext; var pc = templateContext.FindPlaceholderContent(name); DomElement content; if (pc == null) { content = element; } else { content = pc.Element; layoutName = pc.Layout; MergeAttributes(content, element); } var attr = element.Attributes["class"]; if (attr == null) { element.Attribute("class", "app-placeholder"); } else { AttributeAppend(attr, "app-placeholder"); } element.Attribute("data-placeholder", name); element.Attribute("data-layout", layoutName); // TODO Skip over single-page elements that were disabled // TODO Output correct locations var output = hxlOutput.BaseWriter; // TODO We always render element - should attribute selection be allowed to choose another element template? HxlElementTemplate.ProcessAttributesForTemplate(element, templateContext); HxlElementTemplate.RenderElementStart(element, output); hxlOutput.Write(content.ChildNodes); HxlElementTemplate.RenderElementEnd(element, output); }