X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=docs%2Fresources%2Fmake_cover.sh;fp=docs%2Fresources%2Fmake_cover.sh;h=1026ecbd38ad36f63727e8c301e23b83fd0a298c;hb=1dcedd671f892f07d7805c88352661007b88800d;hp=fbbbc02323aa8998dd68a29006d56069add58b3c;hpb=b25e8b11aacd927adfb0278756fb800f879904c5;p=apps%2Fagl-service-can-low-level.git diff --git a/docs/resources/make_cover.sh b/docs/resources/make_cover.sh index fbbbc023..1026ecbd 100755 --- a/docs/resources/make_cover.sh +++ b/docs/resources/make_cover.sh @@ -1,14 +1,27 @@ #!/bin/bash +DOCS_DIR=$(cd $(dirname $0)/.. && pwd) +BOOKFILE=$DOCS_DIR/../book.json -cat cover.svg | sed -e 's/{title}/Low Level CAN binding/' \ - -e 's/font-size:87.5px/font-size:50px/g' \ - -e 's/{subtitle}//g' \ - -e 's/{version}/Version 4.99-EERC1/g' \ - -e 's/{date}/September 2017/g' \ +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 ../cover.jpg + -flatten -quality 100 /tmp/cover.svg $DOCS_DIR/cover.jpg -convert -resize "200x262!" ../cover.jpg ../cover_small.jpg +convert -resize "200x262!" $DOCS_DIR/cover.jpg $DOCS_DIR/cover_small.jpg