summaryrefslogtreecommitdiffstats
path: root/docs/resources/make_cover.sh
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-19 16:43:41 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commite11314b2e9fef34f569bb7b042b432aed661cdc0 (patch)
treeaaaae4d5820238e53a555f290a0a1ea8faa28b9e /docs/resources/make_cover.sh
parentf4fba8a2744991ff8c5cb8af4a67c7d9456f1057 (diff)
Added documentation
Change-Id: Iaa6bb0470652d3d0dc97c6320dbf210567ccec80 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'docs/resources/make_cover.sh')
-rwxr-xr-xdocs/resources/make_cover.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/resources/make_cover.sh b/docs/resources/make_cover.sh
new file mode 100755
index 0000000..1026ecb
--- /dev/null
+++ b/docs/resources/make_cover.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+DOCS_DIR=$(cd $(dirname $0)/.. && pwd)
+BOOKFILE=$DOCS_DIR/../book.json
+
+TITLE=$(grep '"title":' $BOOKFILE | cut -d'"' -f 4)
+SUBTITLE=$(grep '"subtitle":' $BOOKFILE | cut -d'"' -f 4)
+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/font-size:62.5px/font-size:40px/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