public inbox for docbook-tools-discuss@sourceware.org
 help / color / mirror / Atom feed
* docbook-utils patches
  2002-12-20 19:23 docbook-utils patches Mikhail Zabaluev
@ 2002-06-11 16:01 ` Mikhail Zabaluev
  2002-12-20 19:23 ` Tim Waugh
  1 sibling, 0 replies; 4+ messages in thread
From: Mikhail Zabaluev @ 2002-06-11 16:01 UTC (permalink / raw)
  To: twaugh; +Cc: docbook-tools-discuss

[-- 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}'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: docbook-utils patches
  2002-12-20 19:23 ` Tim Waugh
@ 2002-06-27  4:38   ` Tim Waugh
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Waugh @ 2002-06-27  4:38 UTC (permalink / raw)
  To: Mikhail Zabaluev; +Cc: docbook-tools-discuss

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

On Wed, Jun 12, 2002 at 03:04:46AM +0400, Mikhail Zabaluev wrote:

> 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.

Thanks.  Both applied.

Tim.
*/

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* docbook-utils patches
@ 2002-12-20 19:23 Mikhail Zabaluev
  2002-06-11 16:01 ` Mikhail Zabaluev
  2002-12-20 19:23 ` Tim Waugh
  0 siblings, 2 replies; 4+ messages in thread
From: Mikhail Zabaluev @ 2002-12-20 19:23 UTC (permalink / raw)
  To: twaugh; +Cc: docbook-tools-discuss

[-- 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}'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: docbook-utils patches
  2002-12-20 19:23 docbook-utils patches Mikhail Zabaluev
  2002-06-11 16:01 ` Mikhail Zabaluev
@ 2002-12-20 19:23 ` Tim Waugh
  2002-06-27  4:38   ` Tim Waugh
  1 sibling, 1 reply; 4+ messages in thread
From: Tim Waugh @ 2002-12-20 19:23 UTC (permalink / raw)
  To: Mikhail Zabaluev; +Cc: docbook-tools-discuss

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

On Wed, Jun 12, 2002 at 03:04:46AM +0400, Mikhail Zabaluev wrote:

> 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.

Thanks.  Both applied.

Tim.
*/

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-27 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-20 19:23 docbook-utils patches Mikhail Zabaluev
2002-06-11 16:01 ` Mikhail Zabaluev
2002-12-20 19:23 ` Tim Waugh
2002-06-27  4:38   ` Tim Waugh

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).