2016-03-06 20:29:31 -07:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Convert a template file into something like RST
|
|
|
|
#
|
|
|
|
# fix <function>
|
|
|
|
# feed to pandoc
|
|
|
|
# fix \_
|
|
|
|
# title line?
|
|
|
|
#
|
2017-04-05 07:22:55 -06:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
if [ "$#" != "2" ]; then
|
|
|
|
echo "$0 <docbook file> <rst file>"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
DIR=$(dirname $0)
|
2016-03-06 20:29:31 -07:00
|
|
|
|
|
|
|
in=$1
|
|
|
|
rst=$2
|
|
|
|
tmp=$rst.tmp
|
|
|
|
|
|
|
|
cp $in $tmp
|
2017-04-05 07:22:55 -06:00
|
|
|
sed --in-place -f $DIR/convert_template.sed $tmp
|
2016-03-06 20:29:31 -07:00
|
|
|
pandoc -s -S -f docbook -t rst -o $rst $tmp
|
2017-04-05 07:22:55 -06:00
|
|
|
sed --in-place -f $DIR/post_convert.sed $rst
|
2016-03-06 20:29:31 -07:00
|
|
|
rm $tmp
|
2017-04-05 07:22:55 -06:00
|
|
|
echo "book writen to $rst"
|