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