[gtk-doc] mkhtml/pdf: Fix quoting of search path
- From: Stefan Kost <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkhtml/pdf: Fix quoting of search path
- Date: Thu, 29 Sep 2016 21:00:14 +0000 (UTC)
commit 4ba537d4c73a0d4534eeac39ecc3a36793ca1c63
Author: Nirbheek Chauhan <nirbheek centricular com>
Date: Sat Jul 30 16:10:11 2016 +0530
mkhtml/pdf: Fix quoting of search path
We need to do quoting using POSIX sh syntax, so this fix is uglier than simply
using bash arrays.
This still leaves the quoting of imgdirs in mkpdf and I can't see a non-terrible
way to quote that in POSIX sh syntax, but that is usually a relative path and is
less likely to have spaces.
https://bugzilla.gnome.org/show_bug.cgi?id=769125
gtkdoc-mkhtml.in | 38 +++++++++++++++++++-------------------
gtkdoc-mkpdf.in | 28 ++++++++++++++++------------
2 files changed, 35 insertions(+), 31 deletions(-)
---
diff --git a/gtkdoc-mkhtml.in b/gtkdoc-mkhtml.in
index 12aa9f2..4e6e30e 100644
--- a/gtkdoc-mkhtml.in
+++ b/gtkdoc-mkhtml.in
@@ -52,9 +52,9 @@ if test $uninstalled = yes; then
# this does not work from buiddir!=srcdir
gtkdocdir=`dirname $0`
# traditional Bourne shells may not support -e here, use -f
- if test ! -f $gtkdocdir/gtk-doc.xsl; then
+ if test ! -f "$gtkdocdir/gtk-doc.xsl"; then
# try to src dir (set from makefiles) too
- if test -f $ABS_TOP_SRCDIR/gtk-doc.xsl; then
+ if test -f "$ABS_TOP_SRCDIR/gtk-doc.xsl"; then
gtkdocdir=$ABS_TOP_SRCDIR
fi
fi
@@ -68,31 +68,31 @@ else
styledir=$gtkdocdir
fi
-# we could do "$path_option $PWD "
-# to avoid needing rewriting entities that are copied from the header
-# into docs under xml
-if test "X$searchpath" = "X"; then
- path_arg=
-else
- path_arg="--path $searchpath"
-fi
-
# profiling
profile_args=""
if test "$GTKDOC_PROFILE" != ""; then
profile_args="--profile"
fi
-#echo @XSLTPROC@ $path_arg --nonet --xinclude \
-# --stringparam gtkdoc.bookname $module \
-# --stringparam gtkdoc.version "@VERSION@" \
-# "$@" $gtkdocdir/gtk-doc.xsl "$document"
-@XSLTPROC@ 2>profile.txt $profile_args $path_arg --nonet --xinclude \
- --stringparam gtkdoc.bookname $module \
+# We need to use a wrapper because there's no other way to conditionally pass
+# a `--path $searchpath` argument with proper quoting for the path
+run_xsltproc() {
+ # we could do "$path_option $PWD "
+ # to avoid needing rewriting entities that are copied from the header
+ # into docs under xml
+ if test "X$searchpath" = "X"; then
+ @XSLTPROC@ 2>profile.txt $profile_args "$@"
+ else
+ @XSLTPROC@ 2>profile.txt $profile_args --path "$searchpath" "$@"
+ fi
+}
+
+run_xsltproc --nonet --xinclude \
+ --stringparam gtkdoc.bookname "$module" \
--stringparam gtkdoc.version "@VERSION@" \
--stringparam chunk.quietly $quiet \
--stringparam chunker.output.quiet $quiet \
- "$@" $gtkdocdir/gtk-doc.xsl "$document" || exit $?
+ "$@" "$gtkdocdir/gtk-doc.xsl" "$document" || exit $?
# profiling
if test "$GTKDOC_PROFILE" != ""; then
@@ -102,7 +102,7 @@ else
fi
# copy navigation images and stylesheets to html directory ...
-cp -f $styledir/*.png $styledir/*.css ./
+cp -f "$styledir"/*.png "$styledir"/*.css ./
echo "timestamp" > ../html.stamp
diff --git a/gtkdoc-mkpdf.in b/gtkdoc-mkpdf.in
index 8d663b7..9b39ddf 100644
--- a/gtkdoc-mkpdf.in
+++ b/gtkdoc-mkpdf.in
@@ -77,14 +77,18 @@ else
path_option='--directory'
fi
-# we could do "$path_option $PWD "
-# to avoid needing rewriting entities that are copied from the header
-# into docs under xml
-if test "X$searchpath" = "X"; then
- path_arg=
-else
- path_arg="$path_option $searchpath"
-fi
+# We need to use a wrapper because there's no other way to conditionally pass
+# a `--path $searchpath` argument with proper quoting for the path
+run_xsltproc() {
+ # we could do "$path_option $PWD "
+ # to avoid needing rewriting entities that are copied from the header
+ # into docs under xml
+ if test "X$searchpath" = "X"; then
+ @XSLTPROC@ 2>profile.txt "$@"
+ else
+ @XSLTPROC@ 2>profile.txt "$path_option" "$searchpath" "$@"
+ fi
+}
if $is_xml; then
if test -n "@DBLATEX@"; then
@@ -95,7 +99,7 @@ if $is_xml; then
# -d : keep transient files (for debugging)
# -P abc.def=$quiet : once the stylesheets have a quiet mode
# xsltproc is already called with --xinclude
- # does not work: --xslt-opts "$path_arg --nonet $@"
+ # does not work: --xslt-opts "$path_option $searchpath --nonet $@"
dblatex_options="-o $module.pdf $imgdirs $document"
#echo "calling: @DBLATEX@ $dblatex_options"
if test $verbose = "0"; then
@@ -109,12 +113,12 @@ if $is_xml; then
fi
else
if test -n "@FOP@"; then
- @XSLTPROC@ $path_arg --nonet --xinclude \
- --stringparam gtkdoc.bookname $module \
+ run_xsltproc --nonet --xinclude \
+ --stringparam gtkdoc.bookname "$module" \
--stringparam gtkdoc.version "@VERSION@" \
--stringparam chunk.quietly $quiet \
--stringparam chunker.output.quiet $quiet \
- "$@" -o $module.fo $gtkdocdir/gtk-doc-fo.xsl "$document" || cleanexit $?
+ "$@" -o "$module.fo" "$gtkdocdir/gtk-doc-fo.xsl" "$document" || cleanexit $?
# fop dies too easily :(
# @FOP@ $module.fo $module.pdf
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]