diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-21 17:49:35 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-22 09:27:05 +0100 |
commit | 4f1c7e68e5c73f6dcb54b6495b9e3de8456f0376 (patch) | |
tree | c89419b2dd6c2b8a3f3b1583086cafa38b55ba8f | |
parent | 112964f7322fe3e9e95d5469584372768d3c3c26 (diff) |
Update gitbook templates
Updating cover automatically using metadata in books.json
Change-Id: I898fa57c5c86c671aec55f31db0553d969326b26
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rwxr-xr-x | docs/cover.jpg | bin | 232010 -> 211165 bytes | |||
-rw-r--r-- | docs/cover_small.jpg | bin | 12490 -> 11534 bytes | |||
-rw-r--r-- | docs/resources/cover.svg | 48 | ||||
-rw-r--r-- | docs/resources/ebook.css | 16 | ||||
-rwxr-xr-x | gendocs.sh | 49 |
5 files changed, 72 insertions, 41 deletions
diff --git a/docs/cover.jpg b/docs/cover.jpg Binary files differindex 88d2705..1b5dc9c 100755 --- a/docs/cover.jpg +++ b/docs/cover.jpg diff --git a/docs/cover_small.jpg b/docs/cover_small.jpg Binary files differindex d3dac6e..fefef38 100644 --- a/docs/cover_small.jpg +++ b/docs/cover_small.jpg diff --git a/docs/resources/cover.svg b/docs/resources/cover.svg index 55509c7..6726de7 100644 --- a/docs/resources/cover.svg +++ b/docs/resources/cover.svg @@ -89,8 +89,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.24748737" - inkscape:cx="303.38436" - inkscape:cy="1108.7164" + inkscape:cx="928.3577" + inkscape:cy="404.58117" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -159,54 +159,52 @@ <flowRoot xml:space="preserve" id="root-title" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="matrix(2.3469382,0,0,2.3469382,464.13874,-1125.3671)"><flowRegion + transform="matrix(2.3469382,0,0,2.3469382,464.13874,-1200)"><flowRegion id="flowRegion4303"><rect id="rect4305" width="679.99994" height="141.42853" x="-154.28572" - y="359.50504" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1" /></flowRegion><flowPara + y="400"/> + </flowRegion> + <flowPara id="title" style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:87.5px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{title}</flowPara></flowRoot> <flowRoot xml:space="preserve" id="root-subtitle" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="matrix(1.8523279,0,0,1.8523279,553.97647,-524.84064)"><flowRegion + transform="matrix(1.8523279,0,0,1.8523279,553.97647,-380)"><flowRegion id="flowRegion4303-6"><rect id="rect4305-0" width="852.32806" height="154.51677" x="-239.3591" - y="346.41681" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1" /></flowRegion><flowPara + y="290"/> + </flowRegion> + <flowPara id="subtitle" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:62.5px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{subtitle}</flowPara></flowRoot> <flowRoot - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:173.28189087px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:62.5px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{subtitle}</flowPara> + </flowRoot> + <flowRoot id="root-version" xml:space="preserve" transform="translate(-2.0185547,164)"><flowRegion id="flowRegion4169"><rect - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:173.28189087px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1" y="501.68909" x="343.32947" height="99.591171" width="1117.3768" id="rect4171" /></flowRegion><flowPara - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:68.75px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1" id="version">{version}</flowPara></flowRoot> <flowRoot + transform="translate(-2.0185547,238)" xml:space="preserve" - id="root-date" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="matrix(4.3320472,0,0,4.3320472,1023.8272,-788.11995)"><flowRegion - id="flowRegion4303-6-5"><rect - id="rect4305-0-8" - width="251.40364" - height="23.922138" - x="-154.28572" - y="359.50504" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1" /></flowRegion><flowPara + id="root-date"><flowRegion + id="flowRegion4170"><rect + id="rect4172" + width="1117.3768" + height="99.591171" + x="343.32947" + y="501.68909" /></flowRegion><flowPara id="date" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:15.87009525px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{date}</flowPara></flowRoot> </g> + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50px;line-height:125%;font-family:Verdana;-inkscape-font-specification:'Verdana, Bold';text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1">{date}</flowPara></flowRoot> </g> </svg> diff --git a/docs/resources/ebook.css b/docs/resources/ebook.css index 39f126c..e8df4d8 100644 --- a/docs/resources/ebook.css +++ b/docs/resources/ebook.css @@ -70,6 +70,22 @@ div.note p { margin-bottom: 0; } +/* warning blocks */ + +div.warning { + background: #FD9595 none repeat scroll 0% 0%; + color: #8A6D3B; + padding: 15px; + margin-bottom: 10px; + border-bottom: 5px solid #DDD; + border-color: #FF6B6B; + page-break-inside: avoid; +} + +div.warning p { + padding-bottom: 0; + margin-bottom: 0; +} /* images, figures and captions */ @@ -1,6 +1,13 @@ #!/bin/bash +# shellcheck disable=SC2086 + +OUTFILENAME="High_Level_ViWi_Service" + +SCRIPT=$(basename "${BASH_SOURCE[@]}") + +VERSION=$(grep '"version":' "$(dirname "${BASH_SOURCE[@]}")/book.json" | cut -d'"' -f 4) +[ "$VERSION" != "" ] && OUTFILENAME="${OUTFILENAME}_v${VERSION}" -SCRIPT=$(basename $BASH_SOURCE) function usage() { cat <<EOF >&2 @@ -30,38 +37,48 @@ DEBUG_FLAG="" DRY="" DO_ACTION="" OUT_DIR=./build +ARGS="" -[[ $? != 0 ]] && usage +[ $# = 0 ] && usage while [ $# -gt 0 ]; do case "$1" in - --debug) DEBUG_FLAG="--log=debug --debug";; - -d|--dry) DRY=echo;; - -h|--help) usage;; - pdf | serve | doxygen) DO_ACTION=$1;; - --) break;; + --debug) DEBUG_FLAG="--log=debug --debug";; + -d|--dry) DRY="echo";; + -h|--help) usage;; + pdf | serve | doxygen) DO_ACTION=$1;; + --) shift; ARGS="$ARGS $*"; break;; + *) ARGS="$ARGS $1";; esac shift done -cd $(dirname $0) -ROOTDIR=`pwd -P` +cd "$(dirname "$0")" || exit 1 +ROOTDIR=$(pwd -P) # Create out dir if needed [ -d $OUT_DIR ] || mkdir -p $OUT_DIR -if [ "$DO_ACTION" = "pdf" -o "$DO_ACTION" = "serve" ]; then - GITBOOK=`which gitbook` +if [ "$DO_ACTION" = "pdf" ] || [ "$DO_ACTION" = "serve" ]; then + + GITBOOK=$(which gitbook) [ "$?" = "1" ] && { echo "You must install gitbook first, using: sudo npm install -g gitbook-cli"; exit 1; } - EBCONV=`which ebook-convert` + which ebook-convert > /dev/null 2>&1 [ "$?" = "1" ] && { echo "You must install calibre first, using: 'sudo apt install calibre' or refer to https://calibre-ebook.com/download"; exit 1; } + [ ! -d "$ROOTDIR/node_modules" ] && $GITBOOK install + if [ "$DO_ACTION" = "pdf" ]; then - OUTFILE=$OUT_DIR/HighLevelCanBinding_Guide.pdf - $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG - [ "$?" = "0" ] && echo "PDF has been successfully generated in $OUTFILE" + + # Update cover when book.json has been changed + [[ $ROOTDIR/book.json -nt $ROOTDIR/docs/cover.jpg ]] && { echo "Update cover files"; $ROOTDIR/docs/resources/make_cover.sh || exit 1; } + + OUTFILE=$OUT_DIR/$OUTFILENAME.pdf + if $DRY $GITBOOK pdf $ROOTDIR $OUTFILE $DEBUG_FLAG $ARGS; then + echo "PDF has been successfully generated in $OUTFILE" + fi else - $DRY $GITBOOK serve $DEBUG_FLAG + $DRY $GITBOOK serve $DEBUG_FLAG $ARGS fi elif [ "$DO_ACTION" = "doxygen" ]; then |