From c0854750d331c88cc02f75c0a99fa2f8aa7bfb18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Tue, 14 Nov 2023 11:35:11 +0100 Subject: [PATCH] Fix some things, urlencode post names the jinja2 function urlencode is apparently not implemented :( --- ...own => 2014-10-05-17-45-DigitalOcean%20tcpdump?.markdown} | 0 ...1-08-14-10-SSH%20certificates%20with%20Gitolite.markdown} | 0 ...7.markdown => 2017-03-20-11-27-Marrakech%202017.markdown} | 0 src/file.ml | 5 ++++- src/model.ml | 2 +- src/task.ml | 4 ++-- 6 files changed, 7 insertions(+), 4 deletions(-) rename posts/{2014-10-05-17-45-DigitalOcean tcpdump?.markdown => 2014-10-05-17-45-DigitalOcean%20tcpdump?.markdown} (100%) rename posts/{2015-11-08-14-10-SSH certificates with Gitolite.markdown => 2015-11-08-14-10-SSH%20certificates%20with%20Gitolite.markdown} (100%) rename posts/{2017-03-20-11-27-Marrakech 2017.markdown => 2017-03-20-11-27-Marrakech%202017.markdown} (100%) diff --git a/posts/2014-10-05-17-45-DigitalOcean tcpdump?.markdown b/posts/2014-10-05-17-45-DigitalOcean%20tcpdump?.markdown similarity index 100% rename from posts/2014-10-05-17-45-DigitalOcean tcpdump?.markdown rename to posts/2014-10-05-17-45-DigitalOcean%20tcpdump?.markdown diff --git a/posts/2015-11-08-14-10-SSH certificates with Gitolite.markdown b/posts/2015-11-08-14-10-SSH%20certificates%20with%20Gitolite.markdown similarity index 100% rename from posts/2015-11-08-14-10-SSH certificates with Gitolite.markdown rename to posts/2015-11-08-14-10-SSH%20certificates%20with%20Gitolite.markdown diff --git a/posts/2017-03-20-11-27-Marrakech 2017.markdown b/posts/2017-03-20-11-27-Marrakech%202017.markdown similarity index 100% rename from posts/2017-03-20-11-27-Marrakech 2017.markdown rename to posts/2017-03-20-11-27-Marrakech%202017.markdown diff --git a/src/file.ml b/src/file.ml index 1c664ed..d6db82d 100644 --- a/src/file.ml +++ b/src/file.ml @@ -1,7 +1,10 @@ open Yocaml let is_css = with_extension "css" -let is_javascript = with_extension "js" +let is_javascript = + let open Preface.Predicate in + with_extension "js" || + with_extension "map" let is_image = let open Preface.Predicate in diff --git a/src/model.ml b/src/model.ml index 5d713b7..a07721b 100644 --- a/src/model.ml +++ b/src/model.ml @@ -45,7 +45,7 @@ module Article = struct make <$> V.(required_assoc string) "title" assoc <*> V.(required_assoc (Metadata.Date.from (module V))) "date" assoc - <*> V.(required_assoc (Author.from (module V))) "author" assoc) + <*> V.(optional_assoc_or (Author.from (module V))) "author" assoc ~default:Author.default_author) obj let from_string (module V : Metadata.VALIDABLE) = function diff --git a/src/task.ml b/src/task.ml index 18a730a..21b2c97 100644 --- a/src/task.ml +++ b/src/task.ml @@ -28,7 +28,7 @@ let move_images target = let move_js target = process_files [ "js" ] - (fun f -> File.is_javascript f || with_extension "map" f) + File.is_javascript (Build.copy_file ~into:(js_target target)) let move_audio target = @@ -71,7 +71,7 @@ let process_articles target = let articles = let open Build in collection - (read_child_files "posts" (with_extension "md")) + (read_child_files "posts" File.is_markdown) (fun path -> Metaformat.read_file_with_metadata (module Model.Article) path >>^ fun (meta, _data) ->