Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created August 21, 2012 14:35
Show Gist options
  • Select an option

  • Save bouzuya/3416052 to your computer and use it in GitHub Desktop.

Select an option

Save bouzuya/3416052 to your computer and use it in GitHub Desktop.
(defn load-jekyll-post-file
[post-file]
(let [text (slurp post-file)
[_ yaml content] (re-find #"(?m)(?s)^---\s*(.*?)^---\s*^(.*)" text)]
(reduce (fn [m [_ k v]] (assoc m (keyword k) v))
{:content (markdown-to-html content)}
(re-seq #"(\w+):\s*(.*)\n" yaml))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment