Attached is a patch to fix a bug in the DocBook index output. The bug is
that the expanded index entries were being used but, as in the HTML
case, this is no good.
This cause problems such as (from xlstproc):
make.xml:13717: error: error parsing attribute name
<primaryie><D (automatic variable), see <xref linkend="Automatic"></primary
^
And even the unique tags are output'd:
make.xml:12105: error: docbParseStartTag: invalid element name
<secondaryie>quoting with \ (backslash) <1>, see <xref linkend="Text-Functi
^
I took me quite a while to figure this out but I believe this patch does
the Right Thing. At least I hope so.
Please tell me if you need more feedback regarding this and whether you
accept it or not.
Jos� Fonseca
PS: FYI I've hunted this bug (and plan to hunt a few more) in the scope
of producing DevHelp books (a GNOME online-help system for developers)
and CHM (Windows Compiled HTML-Help) books from the documentation of
popular GNU tools, using DocBook XML as an intermediary format and a
series of XSL stylesheets. Everything is already in place (check
http://mefriss1.swan.ac.uk/~jfonseca/devhelp/source/ ), except these minor
glitches in makeinfo.
Index: index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.2
diff -u -r1.2 index.c
--- index.c 5 Nov 2002 03:04:26 -0000 1.2
+++ index.c 6 Nov 2002 23:50:27 -0000
@@ -760,7 +760,11 @@
}
else if (xml && docbook)
{
- xml_insert_indexentry (index->entry, index_node);
+ /* In the DocBook case, the expanded index entry is not
+ good for us, since it was expanded for non-DocBook mode
+ inside sort_index. So we send the original entry text
+ to be used with execute_string. */
+ xml_insert_indexentry (index->entry_text, index_node);
}
else
{
Index: xml.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/xml.c,v
retrieving revision 1.3
diff -u -r1.3 xml.c
--- xml.c 14 Oct 2002 21:25:11 -0000 1.3
+++ xml.c 6 Nov 2002 23:50:29 -0000
@@ -1161,17 +1161,11 @@
}
else
{
- char *expanded;
char *primary = NULL, *secondary;
- xml_sort_index = 1;
- xml_no_para = 1;
- expanded = expansion (indexterm);
- xml_sort_index = 0;
- xml_no_para = 0;
- if (strstr (expanded+1, INDEX_SEP))
+ if (strstr (indexterm+1, INDEX_SEP))
{
- primary = xmalloc (strlen (expanded) + 1);
- strcpy (primary, expanded);
+ primary = xmalloc (strlen (indexterm) + 1);
+ strcpy (primary, indexterm);
secondary = strstr (primary+1, INDEX_SEP);
*secondary = '\0';
secondary += strlen (INDEX_SEP);
@@ -1179,18 +1173,17 @@
xml_insert_element_with_attribute (INDEXTERM, START, "role=\"%s\"", index);
xml_insert_element (PRIMARY, START);
if (primary)
- insert_string (primary);
+ execute_string (primary);
else
- insert_string (expanded);
+ execute_string (indexterm);
xml_insert_element (PRIMARY, END);
if (primary)
{
xml_insert_element (SECONDARY, START);
- insert_string (secondary);
+ execute_string (secondary);
xml_insert_element (SECONDARY, END);
}
xml_insert_element (INDEXTERM, END);
- free (expanded);
}
}
@@ -1317,7 +1310,7 @@
{
xml_insert_element (SECONDARYIE, END);
xml_insert_element (SECONDARYIE, START);
- insert_string (secondary);
+ execute_string (secondary);
}
else
{
@@ -1325,10 +1318,10 @@
xml_insert_element (INDEXENTRY, START);
in_indexentry = 1;
xml_insert_element (PRIMARYIE, START);
- insert_string (primary);
+ execute_string (primary);
xml_insert_element (PRIMARYIE, END);
xml_insert_element (SECONDARYIE, START);
- insert_string (secondary);
+ execute_string (secondary);
in_secondary = 1;
}
}
@@ -1338,7 +1331,7 @@
xml_insert_element (INDEXENTRY, START);
in_indexentry = 1;
xml_insert_element (PRIMARYIE, START);
- insert_string (entry);
+ execute_string (entry);
}
add_word_args (", %s", _("see "));
xml_insert_element_with_attribute (XREF, START, "linkend=\"%s\"", xml_id (node));
