Exemplo n.º 1
0
        /// <summary>
        /// Replace some tag with a list of sections
        /// </summary>
        /// <param name="sectionName">Name of the section.</param>
        /// <param name="sectionList">The section list.</param>
        /// <param name="separator">The separator.</param>
        public void ReplaceSection(string sectionName, TemplateSectionCollection sectionList, string separator = "")
        {
            // Extraigo la sección que quiero reemplazar
            TemplateSection subSection = ExtractSection(sectionName);

            // Remuevo el content de la sección excepto el tag de inicio.
            _contentBuilder.Remove(subSection.FromContentIndex, subSection.ContentLength + subSection.EndTag.Length);

            // Reemplazo el tag de inicio por el content nuevo
            _contentBuilder.Replace(subSection.BeginTag, sectionList.GetAllContent(separator));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Replace some tag with a list of sections
 /// </summary>
 /// <param name="tagName">Tag Name, doesn't need the {} brackets</param>
 /// <param name="sectionList">Section list with all the sections to replace</param>
 /// <param name="isLocalVariable">if set to <c>true</c> [is local variable].</param>
 public void ReplaceTag(string tagName, TemplateSectionCollection sectionList, bool isLocalVariable = true)
 {
     _contentBuilder.Replace(GetReplaceTag(tagName, isLocalVariable), sectionList.GetAllContent());
 }