Skip to content

Commit

Permalink
Restructured build of docs
Browse files Browse the repository at this point in the history
Moved make-book.sh to bin/, generated docs to /target, automated insert of cover image and title update for html.
  • Loading branch information
spmallette committed Oct 16, 2023
1 parent e760393 commit 868f5c5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
*.*.*~
*.iml
**/.idea
book/Practical-Gremlin.epub
book/Practical-Gremlin.html
book/Practical-Gremlin.mobi
book/Practical-Gremlin.pdf
book/Practical-Gremlin.xml
target/
28 changes: 28 additions & 0 deletions bin/make-book.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# create the target directory for where the book will build
rm -rf target
mkdir target

echo "*** Producing HTML ***"
asciidoctor book/Practical-Gremlin.adoc -o target/Practical-Gremlin.html

# asciidoctor won't properly insert the title image and reformatted title so we do
# that manually here
search_string="<h1>PRACTICAL GREMLIN: An Apache TinkerPop Tutorial<\/h1>"
replace_string='<img src="PRACTICAL-GREMLIN-Revised-v2.png">\n<h1>PRACTICAL GREMLIN:<br\/>An Apache TinkerPop Tutorial<\/h1>'
sed -i "s/$search_string/${replace_string}/g" "target/Practical-Gremlin.html"

cp target/Practical-Gremlin.html target/index.html
cp images/PRACTICAL-GREMLIN-Revised-v2.png target/

echo "*** Producing DOCBOOK ***"
asciidoctor -n -b docbook -d book book/Practical-Gremlin.adoc -o target/krltemp.xml
sed -e s/language=\"groovy\"/language=\"java\"/ target/krltemp.xml > target/Practical-Gremlin.xml
rm target/krltemp.xml
echo "*** Producing EPUB ***"
pandoc -f docbook -t epub -N --number-sections --top-level-division=chapter --toc --toc-depth=4 target/Practical-Gremlin.xml -o target/Practical-Gremlin.epub
echo "*** Producing MOBI ***"
ebook-convert target/Practical-Gremlin.epub target/Practical-Gremlin.mobi
echo "*** Producing PDF ***"
asciidoctor-pdf book/Practical-Gremlin.adoc -o target/Practical-Gremlin.pdf
9 changes: 0 additions & 9 deletions book/Practical-Gremlin.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ v2-001-preview, October 1st 2023
// order to run.
//
// 3. pygments (via pip)
//
// The lines below need to be manually added to the HTML file (around line 515) so
// that the book cover art image appears BEFORE the asciidoc document header. The
// <h1> line already in the HTML file should be replaced by these two lines. The PNG
// file also needs to be located in the same place as the HTML file when it is
// viewed.
//
//<img src="PRACTICAL-GREMLIN-Revised-v2.png">
//<h1>PRACTICAL GREMLIN:<br>An Apache TinkerPop Tutorial</h1>

include::Section-Introduction.adoc[]

Expand Down
12 changes: 0 additions & 12 deletions book/make-book.sh

This file was deleted.

0 comments on commit 868f5c5

Please sign in to comment.