示例#1
0
        public static string GetCollapseRegionHtml(string code, BootstrapDemoSectionCollapseRegionType regionType = BootstrapDemoSectionCollapseRegionType.Code)
        {
            string startComment = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "<%--" : "";
            string endComment   = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "--%>" : "";
            string cssClass     = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "more-code" : "more-description";
            string wrapperTag   = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "span" : "div";
            string btnCssClass  = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "btn btn-secondary" : "btn btn-link";
            string coverHtml    = regionType == BootstrapDemoSectionCollapseRegionType.Code ? "" : "<span class=\"more-description-cover\"></span>";

            return(string.Format("{1}<{6} class=\"{3}\">{5}<button type=\"button\" class=\"{4}\" onclick=\"dxbsDemo.codeEditor.expandCode(this)\"></button>" +
                                 "<{6} style=\"display:none\">{2}{0}{1}</{6}></{6}>{2}", code.Trim(' ', '\t', '\r', '\n'), startComment, endComment, cssClass, btnCssClass, coverHtml, wrapperTag));
        }
示例#2
0
 public static string ReplaceCollapseRegion(Regex regex, string code, BootstrapDemoSectionCollapseRegionType regionType = BootstrapDemoSectionCollapseRegionType.Code)
 {
     return(regex.Replace(code, match => {
         return GetCollapseRegionHtml(match.Groups["Code"].Value, regionType);
     }));
 }
示例#3
0
 public static string ReplaceCollapseRegion(string code, BootstrapDemoSectionCollapseRegionType regionType = BootstrapDemoSectionCollapseRegionType.Code)
 {
     return(ReplaceCollapseRegion(CollapseRegex, code, regionType));
 }