public inbox for docbook-tools-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Mikhail Zabaluev <mhz@altlinux.org>
To: twaugh@redhat.com
Cc: docbook-tools-discuss@sources.redhat.com
Subject: docbook-utils patches
Date: Tue, 11 Jun 2002 16:01:00 -0000	[thread overview]
Message-ID: <20020611230446.GD1948@mhz.mikhail.zabaluev.name> (raw)
Message-ID: <20020611160100._W7Hn_mXftJ3DybBWlcCAXBnz5VFZwwO0xit-JqSRLo@z> (raw)

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

Hello,

Here are two patches that solve issues with docbook-utils.
The first plugs in an SGML normalizer to obtain the real
doctype declaration for cases when other <!DOCTYPE
declarations are snuck inside comments.
The second eliminates the need for the A4 stylesheet hack:
it's solved with a parameter redefinition much more
elegantly.

-- 
Stay tuned,
  MhZ                                     JID: mookid@jabber.org
___________
Such a foolish notion, that war is called devotion, when the greatest
warriors are the ones who stand for peace.

[-- Attachment #2: docbook-utils-0.6.10-auto-version.patch --]
[-- Type: text/plain, Size: 2239 bytes --]

--- docbook-utils-0.6.10/bin/jw.in.autover	Mon Apr 15 20:36:15 2002
+++ docbook-utils-0.6.10/bin/jw.in	Tue Jun 11 13:25:22 2002
@@ -293,9 +293,19 @@
 then SGML_DECL=${SGML_BASE_DIR}/xml.dcl
 fi
 
+# Try to find the SGML normalizer
+if [ -z "$SGML_NORM" ]
+then
+  SGML_NORM=`which sgmlnorm 2>/dev/null`
+  if [ -z "SGML_NORM" ]
+  then
+    SGML_NORM=`which osgmlnorm 2>/dev/null`
+  fi
+fi
+
 # Set path to SGML catalogs (first try centralized catalog)
 case $SGML_STANDARD_CATALOGS in
-  yes)	export SGML_CATALOGS_DIR SGML_FILE SGML_XML
+  yes)	export SGML_CATALOGS_DIR SGML_FILE SGML_XML SGML_NORM
 	SGML_CENTRALIZED_CATALOG=`sh $SGML_FRONTEND centralized-catalog`
 	if [ -s $SGML_CENTRALIZED_CATALOG ]
 	then
--- docbook-utils-0.6.10/frontends/docbook.in.autover	Mon Apr 15 20:58:21 2002
+++ docbook-utils-0.6.10/frontends/docbook.in	Tue Jun 11 13:33:23 2002
@@ -6,13 +6,33 @@
 # Give the location of the centralized catalog
 # First try the one with a version matching the version that is indicated in the document
   centralized-catalog)
-	SGML_VERSION=`grep -i '<!DOCTYPE' $SGML_FILE | head -n 1 | sed 's/\(V[0-9][\.0-9]*\).*$/\1/; s/^.* V\([0-9][\.0-9]*\)/\1/'`
-	if [ -f "${SGML_CATALOGS_DIR}/${SGML_XML}-docbook-${SGML_VERSION}"*".cat" ]
-	then echo "${SGML_CATALOGS_DIR}/${SGML_XML}-docbook-${SGML_VERSION}"*".cat"
-	elif [ "${SGML_XML}" != "sgml" ]
-	then echo "${SGML_CATALOGS_DIR}/${SGML_XML}-docbook.cat"
-	else echo "${SGML_CATALOGS_DIR}/catalog"
+	if [ -n "$SGML_NORM" ]; then
+	  SGML_NORM_OPTS='-d'
+	else
+	  SGML_NORM=cat
+	  SGML_NORM_OPTS=
 	fi
+	SGML_VERSION=`"$SGML_NORM" $SGML_NORM_OPTS -- "$SGML_FILE" 2>/dev/null |
+			grep -i '<!DOCTYPE' |
+			head -n 1 |
+			sed 's/^.*DocBook\( XML\)\? V\([0-9][\.0-9]*\).*$/\2/'`
+	SGML_CATALOG=
+	for f in "${SGML_CATALOGS_DIR}/${SGML_XML}-docbook-${SGML_VERSION}"*".cat"
+	do 
+	  if [ -f "$f" ]
+	  then
+	    SGML_CATALOG=$f
+	    break
+	  fi
+	done
+	if [ -z "SGML_CATALOG" ]
+	then
+	  if [ "${SGML_XML}" != "sgml" ]
+	  then SGML_CATALOG=${SGML_CATALOGS_DIR}/${SGML_XML}-docbook.cat
+	  else SGML_CATALOG=${SGML_CATALOGS_DIR}/catalog
+	  fi
+	fi
+	echo "$SGML_CATALOG"
 	;;
 # Find a stylesheet on the model "html/docbook.dsl" or "print/docbook.dsl"
   style-sheet)

[-- Attachment #3: docbook-utils-0.6.10-a4.patch --]
[-- Type: text/plain, Size: 1467 bytes --]

--- docbook-utils-0.6.10/bin/jw.in.a4	Tue Jun 11 14:25:12 2002
+++ docbook-utils-0.6.10/bin/jw.in	Tue Jun 11 14:26:38 2002
@@ -341,6 +351,27 @@
   echo "`basename $0`: Please specify at least one stylesheet" >&2
   exit 5
 fi
+
+case "$SGML_OPTIONS" in
+  *paper-size*)
+	;;
+  *)
+	# Set the paper size to A4 if the locale suggests so
+	papersize=
+	if [ -x /usr/bin/locale ]
+	then
+	  h=$(/usr/bin/locale LC_PAPER 2>/dev/null | head -1)
+	  if [ "$h" = 297 ]
+	  then
+	    papersize=A4
+	  fi
+	fi
+	if [ -n "$papersize" ]
+	then
+	  SGML_OPTIONS="-V paper-size=$papersize $SGML_OPTIONS"
+	fi
+	;;
+esac
 
 # Choose a parser
 if [ -z "$SGML_JADE" ]
--- docbook-utils-0.6.10/frontends/docbook.in.a4	Mon Apr 15 20:58:21 2002
+++ docbook-utils-0.6.10/frontends/docbook.in	Tue Jun 11 14:26:15 2002
@@ -18,21 +18,7 @@
   style-sheet)
 	case $SGML_STYLESHEET in
 	  default)
-	    base="${SGML_BASE_DIR}/docbook/utils-@VERSION@/docbook-utils"
-	    pagesize=
-	    if [ -x /usr/bin/locale ]
-	    then
-	      h=$(locale LC_PAPER 2>/dev/null | head -1)
-	      if [ "$h" = "297" ]
-	      then
-	        pagesize=-a4
-	      fi
-	    fi
-	    if [ -f "${base}${pagesize}.dsl" ]
-	    then
-	      base="${base}${pagesize}"
-	    fi
-	    echo "${base}.dsl#${SGML_TYPE}"
+	    echo "${SGML_BASE_DIR}/docbook/utils-@VERSION@/docbook-utils.dsl#${SGML_TYPE}"
 	    ;;
 	  none)
 	    find $SGML_BASE_DIR -name docbook.dsl | grep "$SGML_TYPE/docbook.dsl" | awk '{print $1}'

             reply	other threads:[~2002-06-11 23:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 19:23 Mikhail Zabaluev [this message]
2002-06-11 16:01 ` Mikhail Zabaluev
2002-12-20 19:23 ` Tim Waugh
2002-06-27  4:38   ` Tim Waugh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020611230446.GD1948@mhz.mikhail.zabaluev.name \
    --to=mhz@altlinux.org \
    --cc=docbook-tools-discuss@sources.redhat.com \
    --cc=twaugh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).