diff options
author | Mauro Carvalho Chehab | 2017-04-05 15:22:55 +0200 |
---|---|---|
committer | Jonathan Corbet | 2017-04-11 22:35:15 +0200 |
commit | 686b0d9bb4d900758b3ed88f037e46671c7ccef7 (patch) | |
tree | 4358093e32b08d6ec3acbe5c4ed9cfc72b766e58 /Documentation/sphinx | |
parent | Merge branch 'user-space-api' into docs-next (diff) | |
download | kernel-qcow2-linux-686b0d9bb4d900758b3ed88f037e46671c7ccef7.tar.gz kernel-qcow2-linux-686b0d9bb4d900758b3ed88f037e46671c7ccef7.tar.xz kernel-qcow2-linux-686b0d9bb4d900758b3ed88f037e46671c7ccef7.zip |
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>
Diffstat (limited to 'Documentation/sphinx')
-rwxr-xr-x | Documentation/sphinx/tmplcvt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Documentation/sphinx/tmplcvt b/Documentation/sphinx/tmplcvt index 909a73065e0a..6848f0a26fa5 100755 --- a/Documentation/sphinx/tmplcvt +++ b/Documentation/sphinx/tmplcvt @@ -7,13 +7,22 @@ # fix \_ # title line? # +set -eu + +if [ "$#" != "2" ]; then + echo "$0 <docbook file> <rst file>" + exit +fi + +DIR=$(dirname $0) in=$1 rst=$2 tmp=$rst.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 -sed --in-place -f post_convert.sed $rst +sed --in-place -f $DIR/post_convert.sed $rst rm $tmp +echo "book writen to $rst" |