Skip to content

Instantly share code, notes, and snippets.

@SevereOverfl0w
Created June 3, 2016 21:13
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 SevereOverfl0w/0a99ad1b84d7a998d98a643d95646eaf to your computer and use it in GitHub Desktop.
Save SevereOverfl0w/0a99ad1b84d7a998d98a643d95646eaf to your computer and use it in GitHub Desktop.
Boot, Asciidoctor, Blogging, Spec
(set-env! :dependencies '[[adzerk/boot-test "1.1.0"]
[im.chit/hara.event "2.2.17"]
[im.chit/hara.time "2.2.17"]
[org.asciidoctor/asciidoctorj "1.5.4"]]
:source-paths #{"test" "src"})
(require '[adzerk.boot-test :refer :all])
(require '[boot.util :refer [dosh]])
(require '[clojure.java.io :as io])
(require '[hara.time :as t])
(defn convert-files
[doctor output files]
(let [opts (-> (org.asciidoctor.OptionsBuilder/options)
(.toDir output)
(.baseDir (io/file ""))
(.safe org.asciidoctor.SafeMode/UNSAFE)
(.mkDirs true)
(.get))]
(.convertFiles doctor files opts)))
(deftask asciidoc
[]
(let [output-dir (tmp-dir!)
doctor (org.asciidoctor.Asciidoctor$Factory/create)]
(with-pre-wrap fs
(let [output-files
(->> fs
input-files
(by-ext [".ad" ".asciidoc" ".adoc"])
(map tmp-file)
(convert-files doctor output-dir))]
(println "Compiling asciidoc...")
(-> fs
(add-resource output-dir)
commit!)))))
(deftask dev
[]
(comp
(watch)
;; (speak)
(asciidoc)
(test)
(target)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment