Exemplo n.º 1
0
 public static string GetSourceFileCode(string fileName)
 {
     fileName = fileName.ToLowerInvariant();
     if (!sourceFilesCode.ContainsKey(fileName))
     {
         string code = BootstrapDemoSectionModel.GetCodeFromFile(fileName);
         sourceFilesCode.AddOrUpdate(fileName, BootstrapDemoSectionCodeParser.GetFormattedCustomCode(code), (exCode, nCode) => nCode);
     }
     return(sourceFilesCode[fileName]);
 }
Exemplo n.º 2
0
        protected string GetPatchedCode(string code)
        {
            var iFrameDemoUrl = BootstrapDemoSectionCodeParser.FindIFrameDemoUrlInCode(code);

            if (!string.IsNullOrEmpty(iFrameDemoUrl))
            {
                code = GetCodeFromFile(iFrameDemoUrl);
            }
            return(code);
        }
Exemplo n.º 3
0
 public static string ProcessDescription(string text)
 {
     if (text == null)
     {
         text = "";
     }
     text = Regex.Replace(text, @"<code\s+lang=([^>]+)>(.*?)</code>", DescriptionCodeReplacer, RegexOptions.Singleline);
     text = HelpLinkRegex.Replace(text, DescriptionHelpLinkReplacer);
     text = BootstrapDemoSectionCodeParser.ReplaceCollapseRegion(text, BootstrapDemoSectionCollapseRegionType.Description);
     return(text);
 }
Exemplo n.º 4
0
 public static string GetCodeFromFile(string virtualPath, string sectionKey = null)
 {
     if (HttpContext.Current != null)
     {
         string path    = HttpContext.Current.Server.MapPath(virtualPath);
         string content = File.ReadAllText(path);
         if (sectionKey != null)
         {
             content = BootstrapDemoSectionCodeParser.GetSectionCode(content, sectionKey);
         }
         return(content);
     }
     return(string.Empty);
 }