tmplcvt: make the tool more robust
Currently, the script just assumes to be called at Documentation/sphinx/. Change it to work on any directory, and make it abort if something gets wrong. Also, be sure that both parameters are specified. That should avoid troubles like this: $ Documentation/sphinx/tmplcvt Documentation/DocBook/writing_usb_driver.tmpl sed: couldn't open file convert_template.sed: No such file or directory Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
3d885bef0c
commit
686b0d9bb4
@ -7,13 +7,22 @@
|
|||||||
# fix \_
|
# fix \_
|
||||||
# title line?
|
# title line?
|
||||||
#
|
#
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "$#" != "2" ]; then
|
||||||
|
echo "$0 <docbook file> <rst file>"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIR=$(dirname $0)
|
||||||
|
|
||||||
in=$1
|
in=$1
|
||||||
rst=$2
|
rst=$2
|
||||||
tmp=$rst.tmp
|
tmp=$rst.tmp
|
||||||
|
|
||||||
cp $in $tmp
|
cp $in $tmp
|
||||||
sed --in-place -f convert_template.sed $tmp
|
sed --in-place -f $DIR/convert_template.sed $tmp
|
||||||
pandoc -s -S -f docbook -t rst -o $rst $tmp
|
pandoc -s -S -f docbook -t rst -o $rst $tmp
|
||||||
sed --in-place -f post_convert.sed $rst
|
sed --in-place -f $DIR/post_convert.sed $rst
|
||||||
rm $tmp
|
rm $tmp
|
||||||
|
echo "book writen to $rst"
|
||||||
|
Loading…
Reference in New Issue
Block a user