Esempio n. 1
0
        static void InlineElement(DomElement e)
        {
            StringWriter fore = new StringWriter();
            StringWriter aft  = new StringWriter();

            HxlElementTemplate.RenderElementStart(e, fore);
            HxlElementTemplate.RenderElementEnd(e, aft);
            HxlRenderWorkElement frag = (HxlRenderWorkElement)e.ChildNodes[0];
            List <string>        pre  = new List <string>();
            List <string>        post = new List <string>();

            pre.Add(CodeUtility.AppendDomText(fore.ToString()));
            pre.AddRange(frag.PreLines);
            post.AddRange(frag.PostLines);
            post.Add(CodeUtility.AppendDomText(aft.ToString()));
            var consolidated = new HxlRenderWorkElement(pre, post);

            frag.RemoveSelf();

            foreach (var m in frag.ChildNodes.ToArray())
            {
                consolidated.Append(m);
            }

            e.ReplaceWith(consolidated);
        }