Package: docbook-to-man
Version: 1:2.0.0-17
Severity: wishlist
Tags: patch

Peter Karman <[EMAIL PROTECTED]> developed a patch.  He wrote:

"Just a couple tweeks necessary to do XML in Instant, mostly for lowercase
instead of upper. The transpec stylesheet must also be all lower-cased to
match the docbook element names. And it must be called with the xml_mode
variable set to 1 (true). I only use the Instant piece of docbook-to-man, so
that's all I patched."

I did not yet test the patch, but I think it would be nice to
have docbook-to-man support XML.  People switching from SGML to
XML can change the sources without changing the toolchain.

Btw, Luk, how about joining Debian XML/SGML Group and go for
team maintainance of docbook-to-man?  You would have to ask
Ardo van Rangelrooij and/or Mark Johnson.
--- ./general.h Sat Jul  3 07:58:23 1999
+++ ../../../docbook-to-man-2.0.0-17/Instant//general.h Tue Jun 21 10:15:38 2005
@@ -232,6 +232,7 @@
 def int                interactive;            /* flag - interactive browsing? */
 def int                slave;                  /* are we slave to another process? */
 def int                fold_case;              /* flag - fold case of GIs? */
+def int                xml_mode;               /* flag - XML-specific hacks */
  
 /* ----- some macros for convenience and ease of code reading ----- */
  
Only in ../../../docbook-to-man-2.0.0-17/Instant/: instant
diff -u ./main.c ../../../docbook-to-man-2.0.0-17/Instant//main.c
--- ./main.c    Sat Jul  3 07:58:23 1999
+++ ../../../docbook-to-man-2.0.0-17/Instant//main.c    Tue Jun 21 10:20:47 2005
@@ -199,6 +199,7 @@
     warnings  = 1;
     fold_case = 1;
     this_prog = myname;
+    xml_mode  = 0;
  
     /* setup global variable mapping */
     Variables = NewMap(IMS_variables);
@@ -258,7 +259,10 @@
        if (!strcmp(tok[0], "verbose"))         verbose   = atoi(tok[1]);
        else if (!strcmp(tok[0], "warnings"))   warnings  = atoi(tok[1]);
        else if (!strcmp(tok[0], "foldcase"))   fold_case = atoi(tok[1]);
+       else if (!strcmp(tok[0], "xmlmode"))    xml_mode = atoi(tok[1]);
        else SetMappingNV(Variables, tok[0], tok[1]);
+
+        if ( xml_mode ) fold_case = 1; /* set for lowercase if xml flag is ON */
     }
     else {
        fprintf(stderr, "Expected an '=' in variable assignment: %s. Ignored\n",
@@ -645,12 +649,18 @@
                               *dst = ((*src-'0') << 6) +
                                      ((*(src+1)-'0') << 3) +
                                      ((*(src+2)-'0'));
+                               if ( xml_mode && *dst == 10 && *(dst-1) == '\n') {
+                                   /* nsgmls outputs \n\012 for XML line endings and we want
+                                    to ignore the \012 */
+                                   /* fprintf(stderr, "found newline!: %c\n", *dst); */
+                                   *dst--;
+                               }
                               src += 3;
                               break;
                            case '#':  case '%':
                               /* Decimal internal(#)/document(%) char */
                               /* XXX: Handle better */
-                              *dst++ = '[';
+                              *dst++ = '[';
                               while (*src != ';') {
                                  *dst++ = *src++;
                               }
@@ -657,7 +667,7 @@
                               *dst++ = ']';
                               src++;
                               /* XXX: Whimp out - no translation */
-                              nomap = 1;
+                              nomap = 1;
                               break;
                            case '|':
                               /* SDATA reference */
@@ -725,9 +735,9 @@
                   /* whether or not whitespace is kept in this element     */
                   cur_e = e;
                   while (cur_e) {
-                     if (pch = FindAttValByName(cur_e,"FORMAT")) {
+                     if (pch = FindAttValByName(cur_e,xml_mode ? "format" : "FORMAT")) {
 #ifdef DEBUG
-                        fprintf(stderr,"   D: Using FORMAT from %s element\n",
+                        fprintf(stderr,"   D: Using format from %s element\n",
                                 cur_e->gi);
 #endif
                         break;
@@ -734,7 +744,7 @@
                      }
                      cur_e = cur_e->parent;
                   }
-                  if (!(pch && !(strcmp(pch,"LINESPECIFIC")))) {
+                  if (!(pch && !(strcmp(pch, xml_mode ? "linespecific" : "LINESPECIFIC")))) {
 #ifdef DEBUG
                      fprintf(stderr,"   D: Compressing whitespace\n");
 #endif

Reply via email to