tmplcvt 437 字节
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/bash
#
# Convert a template file into something like RST
#
# fix <function>
# feed to pandoc
# fix \_
# title line?
#
10 11 12 13 14 15 16 17
set -eu

if [ "$#" != "2" ]; then
	echo "$0 <docbook file> <rst file>"
	exit
fi

DIR=$(dirname $0)
18 19 20 21 22 23

in=$1
rst=$2
tmp=$rst.tmp

cp $in $tmp
24
sed --in-place -f $DIR/convert_template.sed $tmp
25
pandoc -s -S -f docbook -t rst -o $rst $tmp
26
sed --in-place -f $DIR/post_convert.sed $rst
27
rm $tmp
28
echo "book writen to $rst"