blob: 5ab3d7576bf8a679e40917f6dc10f65d9911439a [file] [log] [blame]
Herbert Eiselt092189e2019-04-03 17:24:29 +02001#!/bin/bash
2
3BASEDIR=$(dirname "$0")"/../../../"
4PATH_HELPSERVER_RES=$BASEDIR"sdnr/wt/helpserver/provider/src/main/resources/help/"
5PATH_DOC_DST=$BASEDIR"docs/"
6PATH_DOC_USERDOC_DST=$PATH_DOC_DST"guides/onap-user/"
7
8echo "==================Find .md files in helpserver===================================="
9markdown_files=$(find $PATH_HELPSERVER_RES"sdnr" -type f -iname "*.md")
10echo "$markdown_files[@]"
11
12echo "=============Converting md to rst files=================================="
13for file in ${markdown_files[@]}; do
14 append_name=`echo "$file" | awk -F"/" '{print $(NF-1)}'`
15 f="$(basename -- $file)"
16 if [ "${f,,}" = "readme.md" ]; then
17 rstfile=$append_name".rst"
18 else
19 rstfile=${f%.md}".rst"
20 fi
21
22 echo "$file to $PATH_DOC_USERDOC_DST$rstfile"
23 pandoc -s --toc -f markdown -t rst $file > $PATH_DOC_USERDOC_DST"$rstfile"
24done
25
26cp -r "$BASEDIR"sdnr/wt/readthedocs/src/home.rst "$BASEDIR"docs/guides/onap-user/
27cp -r "$BASEDIR"sdnr/wt/readthedocs/src/index.rst "$BASEDIR"docs/
28
29echo "================Creating html=========================================="
30/usr/local/bin/sphinx-build -b html $PATH_DOC_DST /home/jack/public_html/sdnr-trial/
31