Esempio n. 1
0
 public HomeController(MarkdownLoader markdownLoader)
 {
     markdownBundle = markdownLoader.TryGetBundle("root");
     if (markdownBundle == null)
     {
         throw new ArgumentException("Couldn't get root bundle", nameof(markdownLoader));
     }
 }
Esempio n. 2
0
        private MarkdownPage LoadPage(string directory, string id, MarkdownBundle bundle)
        {
            var file = fileProvider.GetFileInfo($"{directory}/{id}.md");

            using (var reader = file.CreateReader())
            {
                return(MarkdownPage.Load(id, bundle, reader, commonMarkSettings));
            }
        }
Esempio n. 3
0
 public HomeController(MarkdownLoader markdownLoader, ITzdbRepository repository)
 {
     markdownBundle = markdownLoader.TryGetBundle("root");
     if (markdownBundle == null)
     {
         throw new ArgumentException("Couldn't get root bundle", nameof(markdownLoader));
     }
     this.repository = repository;
 }
Esempio n. 4
0
        private MarkdownPage LoadPage(string directory, string id, MarkdownBundle bundle)
        {
            var filename = $"{directory}/{id}.md";

            try
            {
                var file = fileProvider.GetFileInfo(filename);
                using (var reader = file.CreateReader())
                {
                    return(MarkdownPage.Load(id, bundle, reader, commonMarkSettings));
                }
            }
            catch (Exception e)
            {
                throw new Exception($"Unable to parse markdown content from {filename}", e);
            }
        }