diff options
author | Dan Timoney <dtimoney@att.com> | 2019-04-16 13:26:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-16 13:26:27 +0000 |
commit | 7ab848ccda31cef44d4a817f22f2edd5a3d4a205 (patch) | |
tree | 6e49340ce1619e799a8c34883c12a234d34f2e57 /sdnr/wt/readthedocs/convert.sh | |
parent | 582e1d2c65504be8e811bcfaae286102f9de6ee9 (diff) | |
parent | 092189e83c4bd470b9232380dd1a33c63a035606 (diff) |
Merge "SDN-R read2docs"
Diffstat (limited to 'sdnr/wt/readthedocs/convert.sh')
-rwxr-xr-x | sdnr/wt/readthedocs/convert.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sdnr/wt/readthedocs/convert.sh b/sdnr/wt/readthedocs/convert.sh new file mode 100755 index 000000000..5ab3d7576 --- /dev/null +++ b/sdnr/wt/readthedocs/convert.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +BASEDIR=$(dirname "$0")"/../../../" +PATH_HELPSERVER_RES=$BASEDIR"sdnr/wt/helpserver/provider/src/main/resources/help/" +PATH_DOC_DST=$BASEDIR"docs/" +PATH_DOC_USERDOC_DST=$PATH_DOC_DST"guides/onap-user/" + +echo "==================Find .md files in helpserver====================================" +markdown_files=$(find $PATH_HELPSERVER_RES"sdnr" -type f -iname "*.md") +echo "$markdown_files[@]" + +echo "=============Converting md to rst files==================================" +for file in ${markdown_files[@]}; do + append_name=`echo "$file" | awk -F"/" '{print $(NF-1)}'` + f="$(basename -- $file)" + if [ "${f,,}" = "readme.md" ]; then + rstfile=$append_name".rst" + else + rstfile=${f%.md}".rst" + fi + + echo "$file to $PATH_DOC_USERDOC_DST$rstfile" + pandoc -s --toc -f markdown -t rst $file > $PATH_DOC_USERDOC_DST"$rstfile" +done + +cp -r "$BASEDIR"sdnr/wt/readthedocs/src/home.rst "$BASEDIR"docs/guides/onap-user/ +cp -r "$BASEDIR"sdnr/wt/readthedocs/src/index.rst "$BASEDIR"docs/ + +echo "================Creating html==========================================" +/usr/local/bin/sphinx-build -b html $PATH_DOC_DST /home/jack/public_html/sdnr-trial/ + |