Example #1
0
 private void ReloadTemplate(MarkdownTemplate template)
 {
     var contents = File.ReadAllText(template.FilePath);
     foreach (var markdownReplaceToken in MarkdownReplaceTokens)
     {
         contents = contents.Replace(markdownReplaceToken.Key, markdownReplaceToken.Value);
     }
     template.Reload(contents);
 }
Example #2
0
        public MarkdownTemplate AddTemplate(string templatePath, string templateContents)
        {
            var templateFile = new FileInfo(templatePath);
            var templateName = templateFile.FullName.WithoutExtension();

            foreach (var markdownReplaceToken in MarkdownReplaceTokens)
            {
                templateContents = templateContents.Replace(markdownReplaceToken.Key, markdownReplaceToken.Value);
            }

            var template = new MarkdownTemplate(templatePath, templateName, templateContents) {
                LastModified = templateFile.LastWriteTime,
            };
            PageTemplates.Add(templatePath, template);
            try
            {
                template.Prepare();
                return template;
            }
            catch (Exception ex)
            {
                Log.Error("AddViewPage() template.Prepare(): " + ex.Message, ex);
                return null;
            }
        }
 private IVirtualFile GetLatestPage(MarkdownTemplate markdownPage)
 {
     var file = VirtualPathProvider.GetFile(markdownPage.FilePath);
     return file;
 }
        public MarkdownTemplate AddTemplate(string templatePath, string templateContents)
        {
            MarkdownTemplate template;
            if (MasterPageTemplates.TryGetValue(templatePath, out template))             
                return template;

            var templateFile = VirtualPathProvider.GetFile(templatePath);
            var templateName = templateFile.Name.WithoutExtension();
            
            template = new MarkdownTemplate(templatePath, templateName, templateContents) {
                LastModified = templateFile.LastModified,
            };

            MasterPageTemplates.Add(templatePath, template);

            try
            {
                template.Prepare();
                return template;
            }
            catch (Exception ex)
            {
                Log.Error("AddViewPage() template.Prepare(): " + ex.Message, ex);
                return null;
            }
        }
Example #5
0
 private void ReloadTemplate(MarkdownTemplate template)
 {
     var contents = VirtualPathProvider.GetFile(template.FilePath).ReadAllText();
     foreach (var markdownReplaceToken in MarkdownReplaceTokens)
     {
         contents = contents.Replace(markdownReplaceToken.Key, markdownReplaceToken.Value);
     }
     template.Reload(contents);
 }