2014-01-21 16:24:56 -05:00
|
|
|
#!/usr/bin/env bash
|
2014-01-23 15:12:12 -05:00
|
|
|
# Title : build-doc.sh
|
|
|
|
# Description : WSJT-X Documentation build script
|
|
|
|
# Author : KI7MT
|
|
|
|
# Email : ki7mt@yahoo.com
|
2014-01-30 05:09:18 -05:00
|
|
|
# Date : JAN-30-2014
|
|
|
|
# Version : 0.4
|
2014-01-23 15:12:12 -05:00
|
|
|
# Usage : ./build-doc.sh [ option ]
|
|
|
|
# Notes : requires asciidoc, source-highlight
|
|
|
|
#==============================================================================
|
2014-01-21 16:24:56 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
# exit on error
|
2014-01-21 16:24:56 -05:00
|
|
|
set -e
|
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
#add some color
|
|
|
|
red='\033[01;31m'
|
|
|
|
green='\033[01;32m'
|
|
|
|
yellow='\033[01;33m'
|
|
|
|
cyan='\033[01;36m'
|
|
|
|
no_col='\033[01;37m'
|
|
|
|
|
|
|
|
# misc var's
|
2014-01-21 16:24:56 -05:00
|
|
|
base_dir=$(pwd)
|
|
|
|
src_dir="$base_dir/source"
|
2014-01-23 15:12:12 -05:00
|
|
|
c_asciidoc="asciidoc -b xhtml11 -a max-width=1024px"
|
|
|
|
script_name=$(basename $0)
|
2014-01-30 13:03:21 -05:00
|
|
|
doc_version="1.3"
|
2014-01-23 15:12:12 -05:00
|
|
|
|
|
|
|
# build functions
|
|
|
|
function build_no_toc() { # no toc
|
2014-01-25 17:26:21 -05:00
|
|
|
echo -e ${yellow}'Building Main With No TOC'${no_col}
|
|
|
|
$c_asciidoc -o wsjtx-main.html $src_dir/wsjtx-main.adoc
|
|
|
|
echo -e ${green}'.. wsjtx-main.html'${no_col}
|
2014-01-23 15:12:12 -05:00
|
|
|
}
|
2014-01-21 16:24:56 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
function build_toc1() { # top toc
|
2014-01-25 17:26:21 -05:00
|
|
|
echo -e ${yellow}'Building Main with Top TOC'${no_col}
|
|
|
|
$c_asciidoc -a toc -o wsjtx-main-toc1.html $src_dir/wsjtx-main.adoc
|
|
|
|
echo -e ${green}'.. wsjtx-main-toc1.html'${no_col}
|
2014-01-23 15:12:12 -05:00
|
|
|
}
|
2014-01-21 16:24:56 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
function build_toc2() { # left toc
|
2014-01-25 17:26:21 -05:00
|
|
|
echo -e ${yellow}'Building Main with Left TOC'${no_col}
|
|
|
|
$c_asciidoc -a toc2 -o wsjtx-main-toc2.html $src_dir/wsjtx-main.adoc
|
|
|
|
echo -e ${green}'.. wsjtx-main-toc2.html'${no_col}
|
|
|
|
}
|
|
|
|
|
|
|
|
function build_support_pages() { # build all remaining pages
|
|
|
|
echo
|
|
|
|
echo -e ${yellow}'Building Support Pages'${no_col}
|
|
|
|
$c_asciidoc -o rig-config-main.html $src_dir/rig-config-main.adoc
|
|
|
|
echo -e ${green}'.. rig-config-main.html'${no_col}
|
|
|
|
|
|
|
|
# setup rig file array
|
2014-01-30 05:09:18 -05:00
|
|
|
declare -a subpage=('adat' 'alinco' 'aor' 'drake' 'elecraft' 'flexrad' 'icom' \
|
2014-01-25 17:26:21 -05:00
|
|
|
'kenwood' 'softrock' 'tentec' 'yaesu')
|
|
|
|
|
|
|
|
# loop through rig-config pages
|
|
|
|
for rig in "${subpage[@]}"
|
|
|
|
do
|
|
|
|
$c_asciidoc -a toc2 -o rig-config-$rig.html $src_dir/rig-config-$rig.adoc
|
|
|
|
echo -e ${green}".. rig-config-$rig.html"${no_col}
|
|
|
|
done
|
|
|
|
|
|
|
|
$c_asciidoc -o rig-config-template.html $src_dir/rig-config-template.adoc
|
|
|
|
echo -e ${green}'.. rig-config-template.html'${no_col}
|
2014-01-30 05:09:18 -05:00
|
|
|
}
|
2014-01-25 17:26:21 -05:00
|
|
|
|
2014-01-30 05:09:18 -05:00
|
|
|
function build_quick_ref() { # build quick-reference guide
|
|
|
|
echo -e ${yellow}'Building Quick Reference Guide'${no_col}
|
2014-01-25 17:26:21 -05:00
|
|
|
$c_asciidoc -a toc2 -o quick-reference.html $src_dir/quick-reference.adoc
|
|
|
|
echo -e ${green}'.. quick-reference.html'${no_col}
|
2014-01-23 15:12:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# start the main script
|
2014-01-21 16:24:56 -05:00
|
|
|
clear
|
2014-01-25 17:26:21 -05:00
|
|
|
echo -e ${yellow}"*** Building WSJT-X User Guide for:" ${cyan}$doc_version\
|
|
|
|
${no_col}${yellow}" ***\n" ${no_col}
|
2014-01-21 16:24:56 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
# without TOC
|
|
|
|
if [[ $1 = "" ]]
|
|
|
|
then
|
|
|
|
build_no_toc
|
2014-01-30 05:09:18 -05:00
|
|
|
build_quick_ref
|
2014-01-25 17:26:21 -05:00
|
|
|
build_support_pages
|
2014-01-21 16:24:56 -05:00
|
|
|
|
2014-01-30 05:09:18 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
# top TOC
|
|
|
|
elif [[ $1 = "toc1" ]]
|
|
|
|
then
|
|
|
|
build_toc1
|
2014-01-30 05:09:18 -05:00
|
|
|
build_quick_ref
|
2014-01-25 17:26:21 -05:00
|
|
|
build_support_pages
|
2014-01-23 15:12:12 -05:00
|
|
|
|
|
|
|
# left TOC
|
|
|
|
elif [[ $1 = "toc2" ]]
|
|
|
|
then
|
2014-01-30 05:09:18 -05:00
|
|
|
build_toc2
|
|
|
|
build_quick_ref
|
|
|
|
build_support_pages
|
2014-01-23 15:12:12 -05:00
|
|
|
|
|
|
|
# all toc versions
|
|
|
|
elif [[ $1 = "all" ]]
|
|
|
|
then
|
|
|
|
build_no_toc
|
|
|
|
build_toc1
|
|
|
|
build_toc2
|
2014-01-30 05:09:18 -05:00
|
|
|
build_quick_ref
|
2014-01-25 17:26:21 -05:00
|
|
|
build_support_pages
|
2014-01-23 15:12:12 -05:00
|
|
|
|
2014-01-30 05:09:18 -05:00
|
|
|
# quick-reference.html only
|
|
|
|
elif [[ $1 = "quick-ref" ]]
|
|
|
|
then
|
|
|
|
build_quick_ref
|
|
|
|
|
2014-01-25 17:26:21 -05:00
|
|
|
# Usage: if something other than "", toc1, toc2 or all is entered as $1 display usage
|
|
|
|
# message and exit.
|
|
|
|
#
|
|
|
|
# To-Do: this should be re-written to redirect the user to select
|
|
|
|
# 1 of 4 proper options v.s. exiting. Future version should provide
|
|
|
|
# a terminal GUI, Whiptail, Dialog, Zenity etc.
|
2014-01-23 15:12:12 -05:00
|
|
|
else
|
|
|
|
clear
|
|
|
|
echo -e ${red}" * INPUT ERROR *\n"${no_col}
|
|
|
|
echo 'Script Usage: build-doc.sh [ option ]'
|
|
|
|
echo
|
|
|
|
echo 'For with No TOC: ' ./$script_name
|
|
|
|
echo 'For with Top TOC: './$script_name 'toc1'
|
|
|
|
echo 'For with Left TOC: './$script_name 'toc2'
|
|
|
|
echo 'For All Versions: ' ./$script_name 'all'
|
|
|
|
echo
|
|
|
|
echo Please re-enter using the examples above.
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo
|
|
|
|
echo -e ${yellow}'All HTML files have been saved to:'${no_col}${cyan} "$base_dir" ${no_col}
|
|
|
|
echo
|
2014-01-25 17:26:21 -05:00
|
|
|
|
2014-01-23 15:12:12 -05:00
|
|
|
exit 0
|
2014-01-21 16:24:56 -05:00
|
|
|
|