-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from nicorikken/asciidoctor-plugin-redo
feat: asciidoctor plugin
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(ns io.perun.asciidoctor | ||
(:require [io.perun.core :as perun] | ||
[clojure.java.io :as io]) | ||
(:import [org.asciidoctor Asciidoctor Asciidoctor$Factory])) | ||
|
||
(def container | ||
(Asciidoctor$Factory/create "")) | ||
|
||
(defn asciidoctor-to-html [file-content] | ||
(.convert container file-content {})) | ||
|
||
(defn process-asciidoctor [{:keys [entry]}] | ||
(perun/report-debug "asciidoctor" "processing asciidoctor" (:filename entry)) | ||
(let [file-content (-> entry :full-path io/file slurp) | ||
html (asciidoctor-to-html file-content)] | ||
(assoc entry :rendered html))) |
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