Update generator script
authorJo-Philipp Wich <jo@mein.io>
Sun, 3 Apr 2016 20:51:47 +0000 (22:51 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 3 Apr 2016 20:51:47 +0000 (22:51 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
generate.sh

index 876671708c702d20ceefef71804ff42eb9400d91..ea6c42b99b2f5e318726388d82b5d2e8692c5202 100755 (executable)
@@ -6,7 +6,28 @@
 }
 
 D="$(pwd)"
+O="-b html5 -a linkcss -a stylesdir=/css -a stylesheet=lede.css -a disable-javascript"
 
-mkdir -p "$D/html/docs"
-find "$D/pages/" -type f | xargs -L1 a2x -f xhtml -r "$D/" -a "toc!" -a "numbered!" -D "$D/html/"
-find "$D/docs/" -type f | xargs -L1 a2x -f xhtml -r "$D/" -a "toc!" -a "numbered!" -D "$D/html/docs/"
+copy() {(
+       cd "$1"
+       find . -type f | while read path; do
+               dest="$2/${path#./}"
+               mkdir -p "${dest%/*}"
+               cp -a "$path" "$dest"
+       done
+)}
+
+render() {(
+       find "$1" -type f -name '*.txt' | while read path; do
+               dest="$2/${path#$1/}"
+               dest="${dest%.txt}.html"
+               mkdir -p "${dest%/*}"
+               asciidoc $O -o "$dest" "$path"
+       done
+)}
+
+copy "$D/logo" "$D/html/logo"
+copy "$D/css" "$D/html/css"
+
+render "$D/pages" "$D/html"
+render "$D/docs" "$D/html/docs"