Created
October 15, 2019 12:02
-
-
Save Olical/c9a48a06ce243620696e50ce1e318002 to your computer and use it in GitHub Desktop.
Repair translated Markdown -> AsciiDoc files from my blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clojure.string :as str] | |
'[clojure.edn :as edn]) | |
(for [file (fs/list-dir "posts") | |
:when (str/ends-with? (str file) ".md.adoc")] | |
(let [[_ date slug] (re-find #"(\d\d\d\d\-\d\d\-\d\d)\-([\w\-\d]+)\.md\.adoc" (str file)) | |
title (:title (edn/read-string (slurp (fs/file "posts" (str date "-" slug ".md")))))] | |
(spit (fs/file "posts" (str slug ".adoc")) | |
(str "= " title "\nOliver Caldwell\n" date "\n\n" (slurp file))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment