[docbook-utils] improve handling of jw options in db2html, respect --output (#756928)

Ondrej Vasik ovasik at fedoraproject.org
Fri Nov 25 19:51:16 UTC 2011


commit b6ea8c1a3808be8a870273608323b4582c657dbd
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Fri Nov 25 20:51:10 2011 +0100

     improve handling of jw options in db2html,respect --output (#756928)

 db2html            |   27 +++++++++++++++++++++++----
 docbook-utils.spec |    6 +++++-
 2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/db2html b/db2html
index 506433a..ca94b82 100755
--- a/db2html
+++ b/db2html
@@ -5,6 +5,7 @@ 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 ]
@@ -16,15 +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"
-	dbdircleanup=0
-	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
diff --git a/docbook-utils.spec b/docbook-utils.spec
index e55b2cb..36791d1 100644
--- a/docbook-utils.spec
+++ b/docbook-utils.spec
@@ -1,6 +1,6 @@
 Name: docbook-utils
 Version: 0.6.14
-Release: 28%{?dist}
+Release: 29%{?dist}
 Group: Applications/Text
 
 Summary: Shell scripts for managing DocBook documents
@@ -138,6 +138,10 @@ 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)
 


More information about the scm-commits mailing list