[docbook-utils/f16] improve handling of jw options in db2html, respect --output (#756928), cleanup output dir for empty d

Ondrej Vasik ovasik at fedoraproject.org
Fri Nov 25 19:58:11 UTC 2011


commit 8ce2700e5ad091c1fb358f05ff9e5bcd55421ef2
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Fri Nov 25 20:58:07 2011 +0100

    improve handling of jw options in db2html,respect --output (#756928), cleanup output dir for empty db2html input (#756930)

 db2html            |   31 ++++++++++++++++++++++++++++---
 docbook-utils.spec |    9 ++++++++-
 2 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/db2html b/db2html
index 8a1f3a1..ca94b82 100755
--- a/db2html
+++ b/db2html
@@ -4,6 +4,8 @@ ADMON_GRAPHICS=/usr/share/sgml/docbook/dsssl-stylesheets/images/*.gif
 
 output=docbook2html-dir
 skip=0
+dbdircleanup=1
+outputdone=0
 for arg in "$@"
 do
   if [ $skip -gt 0 ]
@@ -15,14 +17,33 @@ do
   -h|--help|-v|--version)	break
 				;;
   -n|--nostd|-u|--nochunks)	;;
+  -o|--output)   outputdone=1
+	         ;;
+
   -*)				skip=1
 				;;
-  *)	output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
-	echo "output is $output"
-	break
+  *)    dbdircleanup=0
+        if [ ${outputdone} -eq 1 ];
+        then
+          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
+          outputfile="$basename "$output""
+          outputdone=2
+        elif [ ${outputdone} -eq 2 ];
+        then
+          outputfile="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,' | \
+                      rev | cut -d'/' -f1 | rev)"
+        else
+          output="$(echo $arg | sed 's,\.sgml$,,;s,\.sgm$,,;s,\.xml,,')"
+          outputfile=$(basename "$output")
+        fi
 	;;
   esac
 done
+
+if [ ${dbdircleanup} -eq 0 ];
+then
+  echo "Output is $output/$outputfile.html"
+fi
 if [ -d ${output} ]
 then
   rm -rf ${output}.junk
@@ -32,3 +53,7 @@ mkdir ${output}
 mkdir ${output}/stylesheet-images
 cp ${ADMON_GRAPHICS} ${output}/stylesheet-images
 jw -f docbook -b html -o ${output} "$@"
+if [ ${dbdircleanup} -eq 1 ];
+then
+  rm -rf ${output}
+fi
diff --git a/docbook-utils.spec b/docbook-utils.spec
index 13e557f..36791d1 100644
--- a/docbook-utils.spec
+++ b/docbook-utils.spec
@@ -1,6 +1,6 @@
 Name: docbook-utils
 Version: 0.6.14
-Release: 27%{?dist}
+Release: 29%{?dist}
 Group: Applications/Text
 
 Summary: Shell scripts for managing DocBook documents
@@ -138,6 +138,13 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/*/docbook2ps.*
 
 %changelog
+* Fri Nov 25 2011 Ondrej Vasik <ovasik at redhat.com> 0.6.14-29
+- improve handling of jw options in db2html,respect
+  --output (#756928)
+
+* Fri Nov 25 2011 Ondrej Vasik <ovasik at redhat.com> 0.6.14-28
+- cleanup output dir for empty db2html input (#756930)
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.14-27
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list