diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-06-19 15:48:58 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-06-19 18:13:10 +0200 |
commit | 7e984551f7ca2e883c5a58cd8dae71dba0db6240 (patch) | |
tree | bbb0e10a4a9cae2d4e0edbb1b368ede8ab3ca1ed /docs/resources/make_cover.sh | |
parent | c521e63554217a67cf69cdefe5bb4672d640b555 (diff) |
Add gitbook documentation (support PDF generation).
To generate PDF doc:
./gendocs.sh pdf
To generate HTML doc (local webserver):
./gendocs.sh serve
Change-Id: Ib9b195814f4596a5cf5233d6a331d206e76c9bae
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs/resources/make_cover.sh')
-rwxr-xr-x | docs/resources/make_cover.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/resources/make_cover.sh b/docs/resources/make_cover.sh new file mode 100755 index 0000000..13ba4f0 --- /dev/null +++ b/docs/resources/make_cover.sh @@ -0,0 +1,26 @@ +#!/bin/bash +DOCS_DIR=$(cd $(dirname $0)/.. && pwd) +BOOKFILE=$DOCS_DIR/../book.json + +TITLE=$(grep '"title":' $BOOKFILE | cut -d'"' -f 4) +SUBTITLE="" +VERSION="Version $(grep '"version":' $BOOKFILE | cut -d'"' -f 4)" +DATE=$(grep '"published":' $BOOKFILE | cut -d'"' -f 4) + +[ -z "$TITLE" ] && { echo "Error TITLE not set!" ; exit 1; } +[ -z "$VERSION" ] && { echo "Error VERSION not set!" ; exit 1; } +[ -z "$DATE" ] && { echo "Error DATE not set!" ; exit 1; } + + +cat $(dirname $0)/cover.svg | sed -e "s/{title}/$TITLE/g" \ + -e "s/font-size:87.5px/font-size:54px/g" \ + -e "s/{subtitle}/$SUBTITLE/g" \ + -e "s/{version}/$VERSION/g" \ + -e "s/{date}/$DATE/g" \ + > /tmp/cover.svg + +# use imagemagick convert tool (cover size must be 1800x2360) +convert -resize "1600x2160!" -border 100 -bordercolor white -background white \ + -flatten -quality 100 /tmp/cover.svg $DOCS_DIR/cover.jpg + +convert -resize "200x262!" $DOCS_DIR/cover.jpg $DOCS_DIR/cover_small.jpg |