From 32184a6c95ed78e2baa1de6a4f21446648b652e2 Mon Sep 17 00:00:00 2001 From: kodfodrasz Date: Thu, 9 Oct 2014 21:27:47 +0200 Subject: [PATCH 1/2] Fix support of --drafts in create command --- src/Pretzel.Logic/Recipe/Recipe.cs | 7 ++++++- src/Pretzel/Commands/RecipeCommand.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Pretzel.Logic/Recipe/Recipe.cs b/src/Pretzel.Logic/Recipe/Recipe.cs index 09e0832d9..1d589aefe 100644 --- a/src/Pretzel.Logic/Recipe/Recipe.cs +++ b/src/Pretzel.Logic/Recipe/Recipe.cs @@ -10,7 +10,7 @@ namespace Pretzel.Logic.Recipe { public class Recipe { - public Recipe(IFileSystem fileSystem, string engine, string directory, IEnumerable additionalIngredients, bool withProject, bool wiki) + public Recipe(IFileSystem fileSystem, string engine, string directory, IEnumerable additionalIngredients, bool withProject, bool wiki, bool withDrafts = false) { this.fileSystem = fileSystem; this.engine = engine; @@ -18,6 +18,7 @@ public Recipe(IFileSystem fileSystem, string engine, string directory, IEnumerab this.additionalIngredients = additionalIngredients; this.withProject = withProject; this.wiki = wiki; + this.withDrafts = withDrafts; } private readonly IFileSystem fileSystem; @@ -26,6 +27,7 @@ public Recipe(IFileSystem fileSystem, string engine, string directory, IEnumerab private readonly IEnumerable additionalIngredients; private readonly bool withProject; private readonly bool wiki; + private readonly bool withDrafts; public void Create() { @@ -161,6 +163,9 @@ private void CreateDirectories() fileSystem.Directory.CreateDirectory(Path.Combine(directory, @"_layouts")); fileSystem.Directory.CreateDirectory(Path.Combine(directory, @"css")); fileSystem.Directory.CreateDirectory(Path.Combine(directory, @"img")); + if (withDrafts) { + fileSystem.Directory.CreateDirectory(Path.Combine(directory, @"_drafts")); + } } } } diff --git a/src/Pretzel/Commands/RecipeCommand.cs b/src/Pretzel/Commands/RecipeCommand.cs index aef53ed5b..b6593b705 100644 --- a/src/Pretzel/Commands/RecipeCommand.cs +++ b/src/Pretzel/Commands/RecipeCommand.cs @@ -41,7 +41,7 @@ public void Execute(IEnumerable arguments) Tracing.Info(string.Format("Using {0} Engine", engine)); - var recipe = new Recipe(fileSystem, engine, parameters.Path, additionalIngredients, parameters.WithProject, parameters.Wiki); + var recipe = new Recipe(fileSystem, engine, parameters.Path, additionalIngredients, parameters.WithProject, parameters.Wiki, parameters.IncludeDrafts); recipe.Create(); } From 4b4856f0f5ae9776d56532c76a4e01991c4c0ca0 Mon Sep 17 00:00:00 2001 From: kodfodrasz Date: Thu, 9 Oct 2014 21:33:00 +0200 Subject: [PATCH 2/2] Fix default site contents errors preventing some files to be transformed * sitemap was invalid xml * rss.xml in razor template project contained errors, related to razor's way of handling html void elements, like link, which is present in the rss.xml format. * removed a magic number from Index.cshtml --- src/Pretzel.Logic/Resources/Liquid/Sitemap.liquid | 2 +- src/Pretzel.Logic/Resources/Razor/Index.cshtml | 2 +- src/Pretzel.Logic/Resources/Razor/Rss.cshtml | 4 ++-- src/Pretzel.Logic/Resources/Razor/Sitemap.cshtml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Pretzel.Logic/Resources/Liquid/Sitemap.liquid b/src/Pretzel.Logic/Resources/Liquid/Sitemap.liquid index fd615561f..a72fbd61a 100644 --- a/src/Pretzel.Logic/Resources/Liquid/Sitemap.liquid +++ b/src/Pretzel.Logic/Resources/Liquid/Sitemap.liquid @@ -11,7 +11,7 @@ layout: nil {% for post in site.posts %} - http://domain/{{ post.url }} + http://domain/{{ post.url }} {{ post.date | date_to_xmlschema }} daily 1.00 diff --git a/src/Pretzel.Logic/Resources/Razor/Index.cshtml b/src/Pretzel.Logic/Resources/Razor/Index.cshtml index 47c38496d..15e3cca02 100644 --- a/src/Pretzel.Logic/Resources/Razor/Index.cshtml +++ b/src/Pretzel.Logic/Resources/Razor/Index.cshtml @@ -51,7 +51,7 @@ title : SiteName

OLDER

    -@foreach(var post in Model.Site.Posts.Skip(5)) +@foreach(var post in Model.Site.Posts.Skip(numberPosts)) {
  • @post.Date.ToString("d m") @post.Title diff --git a/src/Pretzel.Logic/Resources/Razor/Rss.cshtml b/src/Pretzel.Logic/Resources/Razor/Rss.cshtml index e0902e584..7a264d762 100644 --- a/src/Pretzel.Logic/Resources/Razor/Rss.cshtml +++ b/src/Pretzel.Logic/Resources/Razor/Rss.cshtml @@ -17,10 +17,10 @@ layout: nil { @post.Title - http://domain@post.Url + @Raw("")http://domain@(post.Url)@Raw("") @* Workaround: RazorEngine is a HTML5 template engine, where link is a void element *@ @post.Date.ToString("ddd, dd MMM yyyy H:mm:ss K") Author - http://domain@post.Url + http://domain@(post.Url) @post.Content } diff --git a/src/Pretzel.Logic/Resources/Razor/Sitemap.cshtml b/src/Pretzel.Logic/Resources/Razor/Sitemap.cshtml index 44581308d..530846958 100644 --- a/src/Pretzel.Logic/Resources/Razor/Sitemap.cshtml +++ b/src/Pretzel.Logic/Resources/Razor/Sitemap.cshtml @@ -13,7 +13,7 @@ layout: nil @foreach (var post in Model.Site.Posts) { - http://domain/@post.Url + http://domain/@post.Url @post.Date.ToString("s") daily 1.00