makeinfo patch: better docbook translation of definitions

Per Bothner <[email protected]> Fri, 22 Apr 2005 11:23:47 -0700
Newsgroups gmane.comp.tex.texinfo.pretest
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------030407080000010602050203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The current way makeinfo translates definition commands to docbook
is less than optimal.  The most obvious is the initial summary line
is nested within the <blockquote>, so it too gets indented.  This
could be fixed in a stylesheet, I guess, but I think using blockquote
is awkward.  Instead I propose the attached patch.

I tried getting feedback from the docbooks moguls whether this was
a suitable mapping, but got thundering silence.  Any case, this
works for me.
-- 
	--Per Bothner
[email protected]   http://per.bothner.com/

--------------030407080000010602050203
Content-Type: text/x-patch;
 name="mi-defun.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mi-defun.patch"

2005-04-22  Per Bothner  <[email protected]>

	* makeinfo/xml.c (docbook_element_list, xml_begin_defterm): Improved
	docbook translation of definition commands: Use <synopsis> for the
	summary line, and don't include it (only the body) in a <blockquote>.
	Wrap the whole definition in an <informalfigure>.

Index: makeinfo/xml.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/xml.c,v
retrieving revision 1.56
diff -u -p -r1.56 xml.c
--- makeinfo/xml.c	1 Apr 2005 21:30:40 -0000	1.56
+++ makeinfo/xml.c	22 Apr 2005 16:48:19 -0000
@@ -454,13 +454,13 @@ element docbook_element_list [] = {
   { "",                    0, 0, 0 }, /* SETVALUE (xml) */
   { "",                    0, 0, 0 }, /* CLEARVALUE (xml) */
 
-  { "blockquote",          1, 0, 0 }, /* DEFINITION */
-  { "screen",              0, 0, 1 }, /* DEFINITIONTERM */
-  { "",                    0, 0, 0 }, /* DEFINITIONITEM (xml) */
+  { "informalfigure",      1, 0, 0 }, /* DEFINITION */
+  { "synopsis",            0, 0, 1 }, /* DEFINITIONTERM */
+  { "blockquote",          1, 0, 0 }, /* DEFINITIONITEM (xml) */
   { "",                    0, 0, 0 }, /* DEFCATEGORY (xml) */
   { "function",            0, 0, 0 }, /* DEFFUNCTION */
   { "varname",             0, 0, 0 }, /* DEFVARIABLE */
-  { "varname",             0, 0, 0 }, /* DEFPARAM */
+  { "replaceable",         0, 0, 0 }, /* DEFPARAM */
   { "",                    0, 0, 0 }, /* DEFDELIMITER (xml) */
   { "returnvalue",         0, 0, 0 }, /* DEFTYPE */
   { "type",                0, 0, 0 }, /* DEFPARAMTYPE */
@@ -2228,7 +2228,11 @@ xml_begin_def_term (int base_type, const
     char *defined_name, char *type_name, char *type_name2)
 {
   xml_after_def_term = 0;
-  xml_insert_element (DEFINITIONTERM, START);
+  if (docbook)
+    xml_insert_element_with_attribute (DEFINITIONTERM, START,
+				       "role=\"%s\"", category);
+  else
+    xml_insert_element (DEFINITIONTERM, START);
 
   /* Index entry */
   switch (base_type)
@@ -2257,10 +2261,13 @@ xml_begin_def_term (int base_type, const
     }
 
   /* Start with category.  */
-  xml_insert_element (DEFCATEGORY, START);
-  execute_string (docbook ? "--- %s:" : "%s", category);
-  xml_insert_element (DEFCATEGORY, END);
-  add_char(' ');
+  if (! docbook)
+    {
+      xml_insert_element (DEFCATEGORY, START);
+      execute_string (docbook ? "[%s]" : "%s", category);
+      xml_insert_element (DEFCATEGORY, END);
+      add_char(' ');
+    }
 
   /* Output type name first for typed definitions.  */
   switch (base_type)

--------------030407080000010602050203
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Texinfo home page: http://www.gnu.org/software/texinfo/
[email protected]
http://ff0.org/mailman/listinfo/texinfo-pretest

--------------030407080000010602050203--