Skip to content

Instantly share code, notes, and snippets.

@Olical
Created October 15, 2019 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Olical/c9a48a06ce243620696e50ce1e318002 to your computer and use it in GitHub Desktop.
Save Olical/c9a48a06ce243620696e50ce1e318002 to your computer and use it in GitHub Desktop.
Repair translated Markdown -> AsciiDoc files from my blog
(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