From a8ccbd42ed61f5bd5dabcf44aade5ab92285df0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Sat, 27 Dec 2014 07:48:10 +0100 Subject: [PATCH] Allow all markdown files to be processed *.md, *.mkd, *.mkdn, *.mdown and ".markdown are now allowed. --- .../Templating/Context/PathExtensions.cs | 2 +- .../Context/SiteContextGenerator.cs | 2 +- .../Context/SiteContextGeneratorTests.cs | 53 +++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/Pretzel.Logic/Templating/Context/PathExtensions.cs b/src/Pretzel.Logic/Templating/Context/PathExtensions.cs index 94274872e..642411550 100644 --- a/src/Pretzel.Logic/Templating/Context/PathExtensions.cs +++ b/src/Pretzel.Logic/Templating/Context/PathExtensions.cs @@ -5,7 +5,7 @@ namespace Pretzel.Logic.Templating.Context { public static class PathExtensions { - private static readonly string[] MarkdownFiles = new[] { ".md", ".mdown", ".markdown" }; + private static readonly string[] MarkdownFiles = new[] { ".md", ".mkd", ".mkdn", ".mdown", ".markdown" }; private static readonly string[] ImageFiles = new[] { ".png", ".gif", ".jpg" }; public static bool IsMarkdownFile(this string extension) diff --git a/src/Pretzel.Logic/Templating/Context/SiteContextGenerator.cs b/src/Pretzel.Logic/Templating/Context/SiteContextGenerator.cs index 34fcb3167..cdf9758b2 100644 --- a/src/Pretzel.Logic/Templating/Context/SiteContextGenerator.cs +++ b/src/Pretzel.Logic/Templating/Context/SiteContextGenerator.cs @@ -278,7 +278,7 @@ private string RenderContent(string file, string contents, IDictionaryTitle", siteContext.Posts[0].Content.Trim()); + } + + [Fact] + public void site_context_generator_processes_page_markdown_mkdn() + { + // arrange + fileSystem.AddFile(@"C:\TestSite\_posts\2012-01-01-SomeFile.mkdn", new MockFileData(ToPageContent("# Title"))); + + // act + var siteContext = generator.BuildContext(@"C:\TestSite", false); + + // assert + Assert.Equal("

Title

", siteContext.Posts[0].Content.Trim()); + } + + [Fact] + public void site_context_generator_processes_page_markdown_mdown() + { + // arrange + fileSystem.AddFile(@"C:\TestSite\_posts\2012-01-01-SomeFile.mdown", new MockFileData(ToPageContent("# Title"))); + + // act + var siteContext = generator.BuildContext(@"C:\TestSite", false); + + // assert + Assert.Equal("

Title

", siteContext.Posts[0].Content.Trim()); + } + + [Fact] + public void site_context_generator_processes_page_markdown_markdown() + { + // arrange + fileSystem.AddFile(@"C:\TestSite\_posts\2012-01-01-SomeFile.markdown", new MockFileData(ToPageContent("# Title"))); + + // act + var siteContext = generator.BuildContext(@"C:\TestSite", false); + + // assert + Assert.Equal("

Title

", siteContext.Posts[0].Content.Trim()); + } + } } \ No newline at end of file