Пример #1
0
 public void Render(DomElement element,
                    HxlWriter output)
 {
     foreach (var child in element.ChildNodes)
     {
         output.Write(child);
     }
 }
        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);
        }
Пример #3
0
 void IHxlElementTemplate.Render(DomElement element, HxlWriter output)
 {
     RenderElementStart(element, output.BaseWriter);
     output.Write(element.ChildNodes);
     RenderElementEnd(element, output.BaseWriter);
 }