summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/makeinfo
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2003-05-02 00:48:41 +0000
committerru <ru@FreeBSD.org>2003-05-02 00:48:41 +0000
commit374ada20ea75e5e2d1945e7896180bea1f752477 (patch)
tree58bf7fa721f3333d934a90edf15dd134b60feacf /contrib/texinfo/makeinfo
parent4d1fda8c19d6f882c382a685e1c553d80d8f0e11 (diff)
downloadFreeBSD-src-374ada20ea75e5e2d1945e7896180bea1f752477.zip
FreeBSD-src-374ada20ea75e5e2d1945e7896180bea1f752477.tar.gz
Import of stripped down GNU texinfo 4.5
Diffstat (limited to 'contrib/texinfo/makeinfo')
-rw-r--r--contrib/texinfo/makeinfo/README11
-rw-r--r--contrib/texinfo/makeinfo/cmds.c174
-rw-r--r--contrib/texinfo/makeinfo/cmds.h7
-rw-r--r--contrib/texinfo/makeinfo/defun.c61
-rw-r--r--contrib/texinfo/makeinfo/defun.h2
-rw-r--r--contrib/texinfo/makeinfo/files.c4
-rw-r--r--contrib/texinfo/makeinfo/files.h2
-rw-r--r--contrib/texinfo/makeinfo/footnote.c10
-rw-r--r--contrib/texinfo/makeinfo/footnote.h2
-rw-r--r--contrib/texinfo/makeinfo/html.c99
-rw-r--r--contrib/texinfo/makeinfo/html.h14
-rw-r--r--contrib/texinfo/makeinfo/index.c318
-rw-r--r--contrib/texinfo/makeinfo/index.h2
-rw-r--r--contrib/texinfo/makeinfo/insertion.c326
-rw-r--r--contrib/texinfo/makeinfo/insertion.h9
-rw-r--r--contrib/texinfo/makeinfo/lang.c31
-rw-r--r--contrib/texinfo/makeinfo/lang.h5
-rw-r--r--contrib/texinfo/makeinfo/macro.c4
-rw-r--r--contrib/texinfo/makeinfo/macro.h2
-rw-r--r--contrib/texinfo/makeinfo/makeinfo.c739
-rw-r--r--contrib/texinfo/makeinfo/makeinfo.h13
-rw-r--r--contrib/texinfo/makeinfo/multi.c12
-rw-r--r--contrib/texinfo/makeinfo/node.c34
-rw-r--r--contrib/texinfo/makeinfo/node.h4
-rw-r--r--contrib/texinfo/makeinfo/sectioning.c72
-rw-r--r--contrib/texinfo/makeinfo/sectioning.h2
-rw-r--r--contrib/texinfo/makeinfo/texinfo.dtd6
-rw-r--r--contrib/texinfo/makeinfo/texinfo.xsl2
-rw-r--r--contrib/texinfo/makeinfo/toc.c30
-rw-r--r--contrib/texinfo/makeinfo/toc.h2
-rw-r--r--contrib/texinfo/makeinfo/xml.c624
-rw-r--r--contrib/texinfo/makeinfo/xml.h11
32 files changed, 1517 insertions, 1117 deletions
diff --git a/contrib/texinfo/makeinfo/README b/contrib/texinfo/makeinfo/README
index 1b45f02..4d2ecf6 100644
--- a/contrib/texinfo/makeinfo/README
+++ b/contrib/texinfo/makeinfo/README
@@ -1,7 +1,16 @@
+$Id: README,v 1.2 2002/09/11 16:32:09 karl Exp $
+texinfo/makeinfo/README
+
+ Copyright (C) 2002 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved.
+
makeinfo is a standalone program to convert Texinfo source into Info
files readable with standalone info or M-x info in Emacs.
-makeinfo can also output plain ASCII (with --no-headers)
+makeinfo can also output other formats: plain ASCII (with --no-headers)
or HTML (with --html) or XML (with --xml).
The Emacs function M-x texinfo-format-buffer does more or less the same
diff --git a/contrib/texinfo/makeinfo/cmds.c b/contrib/texinfo/makeinfo/cmds.c
index 7de972b..5ff0b5d 100644
--- a/contrib/texinfo/makeinfo/cmds.c
+++ b/contrib/texinfo/makeinfo/cmds.c
@@ -1,7 +1,8 @@
/* cmds.c -- Texinfo commands.
- $Id: cmds.c,v 1.79 2002/03/28 16:35:29 karl Exp $
+ $Id: cmds.c,v 1.16 2003/01/12 15:18:24 karl Exp $
- Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,6 +23,7 @@
#include "defun.h"
#include "files.h"
#include "footnote.h"
+#include "html.h"
#include "insertion.h"
#include "lang.h"
#include "macro.h"
@@ -64,7 +66,7 @@ void
cm_defcodeindex (), cm_result (), cm_expansion (), cm_equiv (),
cm_print (), cm_error (), cm_point (), cm_today (), cm_flushleft (),
cm_flushright (), cm_finalout (), cm_cartouche (), cm_detailmenu (),
- cm_multitable (), cm_settitle (), cm_titlefont (), cm_tt (),
+ cm_multitable (), cm_settitle (), cm_titlefont (), cm_titlepage (), cm_tie (), cm_tt (),
cm_verbatim (), cm_verbatiminclude ();
/* Conditionals. */
@@ -237,9 +239,11 @@ COMMAND command_table[] = {
{ "ifnotinfo", cm_ifnotinfo, NO_BRACE_ARGS },
{ "ifnotplaintext", cm_ifnotplaintext, NO_BRACE_ARGS },
{ "ifnottex", cm_ifnottex, NO_BRACE_ARGS },
+ { "ifnotxml", cm_ifnotxml, NO_BRACE_ARGS },
{ "ifplaintext", cm_ifplaintext, NO_BRACE_ARGS },
{ "ifset", cm_ifset, NO_BRACE_ARGS },
{ "iftex", cm_iftex, NO_BRACE_ARGS },
+ { "ifxml", cm_ifxml, NO_BRACE_ARGS },
{ "ignore", command_name_condition, NO_BRACE_ARGS },
{ "image", cm_image, BRACE_ARGS },
{ "include", cm_include, NO_BRACE_ARGS },
@@ -320,10 +324,11 @@ COMMAND command_table[] = {
{ "tab", cm_tab, NO_BRACE_ARGS },
{ "table", cm_table, NO_BRACE_ARGS },
{ "tex", cm_tex, NO_BRACE_ARGS },
+ { "tie", cm_tie, BRACE_ARGS },
{ "tieaccent", cm_accent, MAYBE_BRACE_ARGS },
{ "tindex", cm_tindex, NO_BRACE_ARGS },
{ "titlefont", cm_titlefont, BRACE_ARGS },
- { "titlepage", command_name_condition, NO_BRACE_ARGS },
+ { "titlepage", cm_titlepage, NO_BRACE_ARGS },
{ "today", cm_today, BRACE_ARGS },
{ "top", cm_top, NO_BRACE_ARGS },
{ "u", cm_accent, MAYBE_BRACE_ARGS },
@@ -345,6 +350,7 @@ COMMAND command_table[] = {
{ "vindex", cm_vindex, NO_BRACE_ARGS },
{ "vtable", cm_vtable, NO_BRACE_ARGS },
{ "w", cm_w, BRACE_ARGS },
+ { "xml", cm_html, NO_BRACE_ARGS },
{ "xref", cm_xref, BRACE_ARGS },
/* Deprecated commands. These used to be for italics. */
@@ -387,9 +393,9 @@ insert_space (arg)
if (arg == START)
{
if (xml && !docbook)
- xml_insert_entity ("space");
+ xml_insert_entity ("space");
else
- add_char (' ');
+ add_char (' ');
}
}
@@ -418,11 +424,12 @@ cm_dots (arg)
if (arg == START)
{
if (xml && !docbook)
- xml_insert_entity ("dots");
+ xml_insert_entity ("dots");
else if (docbook)
- xml_insert_entity ("hellip");
+ xml_insert_entity ("hellip");
else
- add_word (html ? "<small>...</small>" : "...");
+ add_word (html && !in_fixed_width_font
+ ? "<small class=\"dots\">...</small>" : "...");
}
}
@@ -441,7 +448,8 @@ cm_enddots (arg)
add_char ('.');
}
else
- add_word (html ? "<small>...</small>." : "....");
+ add_word (html && !in_fixed_width_font
+ ? "<small class=\"enddots\">....</small>" : "....");
}
}
@@ -553,24 +561,24 @@ cm_code (arg)
xml_insert_element (CODE, arg);
else
{
- extern int printing_index;
+ extern int printing_index;
- if (arg == START)
- {
- in_fixed_width_font++;
+ if (arg == START)
+ {
+ in_fixed_width_font++;
- if (html)
+ if (html)
+ insert_html_tag (arg, "code");
+ else if (!printing_index)
+ add_char ('`');
+ }
+ else if (html)
insert_html_tag (arg, "code");
- else if (!printing_index)
- add_char ('`');
- }
- else if (html)
- insert_html_tag (arg, "code");
- else
- {
- if (!printing_index)
- add_meta_char ('\'');
- }
+ else
+ {
+ if (!printing_index)
+ add_meta_char ('\'');
+ }
}
}
@@ -604,9 +612,10 @@ cm_url (arg, start, end)
else if (html)
{
if (arg == START)
- add_word ("&lt;<code>");
- else
- add_word ("</code>&gt;");
+ add_word ("&lt;");
+ insert_html_tag (arg, "code");
+ if (arg != START)
+ add_word ("&gt;");
}
else
if (arg == START)
@@ -748,7 +757,7 @@ cm_verb (arg)
last_char_was_newline = 0;
if (html)
- add_word ("<pre>");
+ add_word ("<tt>");
if (input_text_offset < input_text_length)
{
@@ -770,18 +779,28 @@ cm_verb (arg)
character = curchar ();
if (character == '\n')
- line_number++;
- /*
- Assume no newlines in END_VERBATIM
- */
+ {
+ line_number++;
+ if (html)
+ add_word ("<br>\n");
+ }
+
+ else if (html && character == '<')
+ add_word ("&lt;");
+
+ else if (html && character == '&')
+ add_word ("&amp;");
+
else if (character == delimiter)
- {
+ { /* Assume no newlines in END_VERBATIM. */
seen_end = 1;
input_text_offset++;
break;
}
- add_char (character);
+ else
+ add_char (character);
+
input_text_offset++;
}
@@ -798,9 +817,12 @@ cm_verb (arg)
}
if (html)
- add_word ("</pre>");
+ add_word ("</tt>");
+
+ in_fixed_width_font--;
}
+
void
cm_strong (arg, position)
int arg, position;
@@ -872,25 +894,9 @@ cm_r (arg)
xml_insert_element (R, arg);
else
{
- extern int printing_index;
+ if (html)
+ insert_html_tag (arg, "");
- /* People use @r{} in index entries like this:
-
- @findex foo@r{, some text}
-
- This is supposed to produce output as if the entry were saying
- "@code{foo}, some text", since the "fn" index is typeset as
- @code. The following attempts to do the same in HTML. Note that
- this relies on the fact that only @code bumps up the variable
- in_fixed_width_font while processing index entries in HTML mode. */
- if (html && printing_index)
- {
- int level = in_fixed_width_font;
-
- while (level--)
- insert_html_tag (arg == START ? END : START, "code");
- }
-
not_fixed_width (arg);
}
}
@@ -902,7 +908,27 @@ cm_titlefont (arg)
if (xml)
xml_insert_element (TITLEFONT, arg);
else
- not_fixed_width (arg);
+ {
+ not_fixed_width (arg);
+ if (html)
+ {
+ html_title_written = 1; /* suppress title from @settitle */
+ if (arg == START)
+ add_word ("<h1 class=\"titlefont\">");
+ else
+ add_word ("</h1>\n");
+ }
+ }
+}
+
+int titlepage_cmd_present = 0;
+
+void
+cm_titlepage (arg)
+ int arg;
+{
+ titlepage_cmd_present = 1;
+ command_name_condition ();
}
/* Various commands are no-op's. */
@@ -932,6 +958,22 @@ cm_w (arg, start, end)
}
+/* An unbreakable word space. Same as @w{ } for makeinfo, but different
+ for TeX (the space stretches and stretches, and does not inhibit
+ hyphenation). */
+void
+cm_tie (arg)
+ int arg;
+{
+ if (arg == START)
+ {
+ cm_w (START);
+ add_char (' ');
+ }
+ else
+ cm_w (END);
+}
+
/* Explain that this command is obsolete, thus the user shouldn't
do anything with it. */
static void
@@ -976,9 +1018,16 @@ cm_settitle ()
{
xml_begin_document (current_output_filename);
xml_insert_element (SETTITLE, START);
+ xml_in_book_title = 1;
get_rest_of_line (0, &title);
execute_string ("%s", title);
+ xml_in_book_title = 0;
xml_insert_element (SETTITLE, END);
+ if (docbook && !xml_in_bookinfo)
+ {
+ xml_insert_element (BOOKINFO, START);
+ xml_in_bookinfo = 1;
+ }
}
else
get_rest_of_line (0, &title);
@@ -1115,7 +1164,7 @@ cm_center ()
execute_string ("%s", (char *)line);
free (line);
uninhibit_output_flushing ();
- if (html)
+ if (html)
add_word ("</div>");
else
@@ -1214,7 +1263,7 @@ cm_exdent ()
int save_indent = current_indent;
int save_in_fixed_width_font = in_fixed_width_font;
- /* Read argument */
+ /* Read argument. */
get_rest_of_line (0, &line);
/* Exdent the output. Actually this may be a no-op. */
@@ -1242,6 +1291,7 @@ cm_exdent ()
current_indent = save_indent;
in_fixed_width_font = save_in_fixed_width_font;
+ start_paragraph ();
}
/*
@@ -1253,13 +1303,17 @@ static void
handle_include (verbatim_include)
int verbatim_include;
{
- char *filename;
+ char *arg, *filename;
if (macro_expansion_output_stream && !executing_string)
me_append_before_this_command ();
close_paragraph ();
- get_rest_of_line (0, &filename);
+ get_rest_of_line (0, &arg);
+ /* We really only want to expand @value, but it's easier to just do
+ everything. TeX will only work with @value. */
+ filename = text_expansion (arg);
+ free (arg);
if (macro_expansion_output_stream && !executing_string)
remember_itext (input_text, input_text_offset);
@@ -1283,8 +1337,6 @@ handle_include (verbatim_include)
if (!find_and_load (filename))
{
- extern int errno;
-
popfile ();
line_number--;
diff --git a/contrib/texinfo/makeinfo/cmds.h b/contrib/texinfo/makeinfo/cmds.h
index 7edc810..e9b860a 100644
--- a/contrib/texinfo/makeinfo/cmds.h
+++ b/contrib/texinfo/makeinfo/cmds.h
@@ -1,7 +1,7 @@
/* cmds.h -- declarations for cmds.c.
- $Id: cmds.h,v 1.4 1999/04/25 20:43:51 karl Exp $
+ $Id: cmds.h,v 1.3 2002/11/04 22:15:19 karl Exp $
- Copyright (C) 1998, 99 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,4 +47,7 @@ typedef struct
extern COMMAND command_table[];
+/* Nonzero if we have seen an @titlepage command. */
+extern int titlepage_cmd_present;
+
#endif /* !CMDS_H */
diff --git a/contrib/texinfo/makeinfo/defun.c b/contrib/texinfo/makeinfo/defun.c
index 49dbd43..ce56059 100644
--- a/contrib/texinfo/makeinfo/defun.c
+++ b/contrib/texinfo/makeinfo/defun.c
@@ -1,7 +1,7 @@
/* defun.c -- @defun and friends.
- $Id: defun.c,v 1.19 2002/03/18 16:54:54 karl Exp $
+ $Id: defun.c,v 1.3 2002/11/11 00:57:49 feloy Exp $
- Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,9 +19,11 @@
#include "system.h"
#include "defun.h"
-#include "docbook.h"
+#include "xml.h"
#include "insertion.h"
#include "makeinfo.h"
+#include "cmds.h"
+#include "html.h"
#define DEFUN_SELF_DELIMITING(c) \
@@ -239,7 +241,13 @@ process_defun_args (defun_args, auto_var_p)
}
if (DEFUN_SELF_DELIMITING (defun_arg[0]))
- add_char (defun_arg[0]);
+ {
+ /* Within @deffn and friends, texinfo.tex makes parentheses
+ sans serif and brackets bold. We use roman instead. */
+ insert_html_tag (START, "");
+ add_char (defun_arg[0]);
+ insert_html_tag (END, "");
+ }
else if (defun_arg[0] == '&')
if (html)
{
@@ -446,8 +454,6 @@ defun_internal (type, x_p)
/* Start the definition on new paragraph. */
if (html)
add_word ("<p>\n");
- if (docbook)
- docbook_begin_paragraph ();
}
if (!html && !docbook)
@@ -506,30 +512,34 @@ defun_internal (type, x_p)
case defvr:
case deftp:
/* <i> is for the following function arguments. */
- add_word ("<b>");
+ insert_html_tag (START, "b");
execute_string ("%s", defined_name);
- add_word ("</b><i>");
+ insert_html_tag (END, "b");
+ insert_html_tag (START, "i");
break;
case deftypefn:
case deftypevr:
execute_string ("%s ", type_name);
- add_word ("<b>");
+ insert_html_tag (START, "b");
execute_string ("%s", defined_name);
- add_word ("</b><i>");
+ insert_html_tag (END, "b");
+ insert_html_tag (START, "i");
break;
case defcv:
case defop:
- add_word ("<b>");
+ insert_html_tag (START, "b");
execute_string ("%s", defined_name);
- add_word ("</b><i>");
+ insert_html_tag (END, "b");
+ insert_html_tag (START, "i");
break;
case deftypemethod:
case deftypeop:
case deftypeivar:
execute_string ("%s ", type_name2);
- add_word ("<b>");
+ insert_html_tag (START, "b");
execute_string ("%s", defined_name);
- add_word ("</b><i>");
+ insert_html_tag (END, "b");
+ insert_html_tag (START, "i");
break;
}
} /* if (html)... */
@@ -543,19 +553,24 @@ defun_internal (type, x_p)
case deftp:
case defcv:
case defop:
- add_word_args ("<%s>%s</%s>", DB_FUNCTION, defined_name,
- DB_FUNCTION);
+ xml_insert_element (FUNCTION, START);
+ execute_string ("%s", defined_name);
+ xml_insert_element (FUNCTION, END);
break;
case deftypefn:
case deftypevr:
- add_word_args ("%s <%s>%s</%s>", type_name, DB_FUNCTION,
- defined_name, DB_FUNCTION);
+ execute_string ("%s", type_name);
+ xml_insert_element (FUNCTION, START);
+ execute_string ("%s", defined_name);
+ xml_insert_element (FUNCTION, END);
break;
case deftypemethod:
case deftypeop:
case deftypeivar:
- add_word_args ("%s <%s>%s</%s>", type_name2, DB_FUNCTION,
- defined_name, DB_FUNCTION);
+ execute_string ("%s", type_name2);
+ xml_insert_element (FUNCTION, START);
+ execute_string ("%s", defined_name);
+ xml_insert_element (FUNCTION, END);
break;
}
@@ -602,7 +617,7 @@ defun_internal (type, x_p)
case deftp:
case deftypefn:
case deftypevr:
- add_word ("</i>"); /* close italic area for arguments */
+ insert_html_tag (END, "i"); /* close italic area for arguments */
/* put the rest into the second column */
add_word ("</td>\n");
add_html_elt ("<td align=\"right\">");
@@ -618,14 +633,14 @@ defun_internal (type, x_p)
case defop:
case deftypemethod:
case deftypeop:
- add_word ("</i>");
+ insert_html_tag (END, "i");
add_word ("</td>\n");
add_html_elt ("<td align=\"right\">");
execute_string ("%s %s %s", category, _("on"), type_name);
break;
case deftypeivar:
- add_word ("</i>");
+ insert_html_tag (END, "i");
add_word ("</td>\n");
add_html_elt ("<td align=\"right\">");
execute_string ("%s %s %s", category, _("of"), type_name);
diff --git a/contrib/texinfo/makeinfo/defun.h b/contrib/texinfo/makeinfo/defun.h
index ebff9d6..a701201 100644
--- a/contrib/texinfo/makeinfo/defun.h
+++ b/contrib/texinfo/makeinfo/defun.h
@@ -1,5 +1,5 @@
/* defun.h -- declaration for defuns.
- $Id: defun.h,v 1.2 1999/03/25 22:49:10 karl Exp $
+ $Id: defun.h,v 1.1 2002/08/25 23:38:38 karl Exp $
Copyright (C) 1999 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/files.c b/contrib/texinfo/makeinfo/files.c
index 83c00e1..2c3fc10 100644
--- a/contrib/texinfo/makeinfo/files.c
+++ b/contrib/texinfo/makeinfo/files.c
@@ -1,7 +1,7 @@
/* files.c -- file-related functions for makeinfo.
- $Id: files.c,v 1.10 2002/01/16 15:52:45 karl Exp $
+ $Id: files.c,v 1.1 2002/08/25 23:38:38 karl Exp $
- Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/contrib/texinfo/makeinfo/files.h b/contrib/texinfo/makeinfo/files.h
index 88ae209..e2a1069 100644
--- a/contrib/texinfo/makeinfo/files.h
+++ b/contrib/texinfo/makeinfo/files.h
@@ -1,5 +1,5 @@
/* files.h -- declarations for files.c.
- $Id: files.h,v 1.2 2002/01/16 15:52:45 karl Exp $
+ $Id: files.h,v 1.1 2002/08/25 23:38:38 karl Exp $
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/footnote.c b/contrib/texinfo/makeinfo/footnote.c
index d9f2525..5a11028 100644
--- a/contrib/texinfo/makeinfo/footnote.c
+++ b/contrib/texinfo/makeinfo/footnote.c
@@ -1,7 +1,7 @@
/* footnote.c -- footnotes for Texinfo.
- $Id: footnote.c,v 1.13 2002/03/02 15:05:21 karl Exp $
+ $Id: footnote.c,v 1.4 2002/11/05 03:04:26 karl Exp $
- Copyright (C) 1998, 99, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -237,7 +237,7 @@ cm_footnote ()
`fn-<n>', though that's unlikely. */
if (html)
{
- add_html_elt ("<a rel=footnote href=");
+ add_html_elt ("<a rel=\"footnote\" href=");
add_word_args ("\"#fn-%d\"><sup>%s</sup></a>",
current_footnote_number, marker);
}
@@ -294,7 +294,7 @@ output_pending_notes ()
out there doesn't use numbers by default. Since we rely on the
browser to produce the footnote numbers, we need to make sure
they ARE indeed numbers. Pre-HTML4 browsers seem to not care. */
- add_word ("<hr><h4>");
+ add_word ("<div class=\"footnote\">\n<hr>\n<h4>");
add_word (_("Footnotes"));
add_word ("</h4>\n<ol type=\"1\">\n");
}
@@ -372,7 +372,7 @@ output_pending_notes ()
}
if (html)
- add_word ("</ol><hr>");
+ add_word ("</ol><hr></div>");
close_paragraph ();
free (array);
}
diff --git a/contrib/texinfo/makeinfo/footnote.h b/contrib/texinfo/makeinfo/footnote.h
index c87a0aa..ad6ac85 100644
--- a/contrib/texinfo/makeinfo/footnote.h
+++ b/contrib/texinfo/makeinfo/footnote.h
@@ -1,5 +1,5 @@
/* footnote.h -- declarations for footnote.c.
- $Id: footnote.h,v 1.2 1998/10/26 22:16:15 karl Exp $
+ $Id: footnote.h,v 1.1 2002/08/25 23:38:38 karl Exp $
Copyright (C) 1998 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/html.c b/contrib/texinfo/makeinfo/html.c
index c03f4f7..51960fc 100644
--- a/contrib/texinfo/makeinfo/html.c
+++ b/contrib/texinfo/makeinfo/html.c
@@ -1,7 +1,7 @@
/* html.c -- html-related utilities.
- $Id: html.c,v 1.26 2002/03/23 20:39:49 karl Exp $
+ $Id: html.c,v 1.8 2002/11/04 22:14:40 karl Exp $
- Copyright (C) 1999, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,14 +24,16 @@
#include "makeinfo.h"
#include "sectioning.h"
+HSTACK *htmlstack = NULL;
+
/* See html.h. */
int html_output_head_p = 0;
+int html_title_written = 0;
void
html_output_head ()
{
static char *html_title = NULL;
- static int html_title_written = 0;
if (html_output_head_p)
return;
@@ -53,10 +55,12 @@ html_output_head ()
if (!document_description)
document_description = html_title;
- add_word_args ("<meta name=description content=\"%s\">\n",
+ add_word_args ("<meta name=\"description\" content=\"%s\">\n",
document_description);
- add_word_args ("<meta name=generator content=\"makeinfo %s\">\n", VERSION);
- add_word ("<link href=\"http://www.gnu.org/software/texinfo/\" rel=generator-home>\n");
+ add_word_args ("<meta name=\"generator\" content=\"makeinfo %s\">\n",
+ VERSION);
+ add_word ("<link href=\"http://www.gnu.org/software/texinfo/\" \
+rel=\"generator-home\">\n");
if (copying_text)
{ /* copying_text has already been fully expanded in
@@ -71,9 +75,9 @@ html_output_head ()
add_word ("</head>\n<body>\n");
- if (title && !html_title_written)
+ if (title && !html_title_written && titlepage_cmd_present)
{
- add_word_args ("<h1>%s</h1>\n", html_title);
+ add_word_args ("<h1 class=\"settitle\">%s</h1>\n", html_title);
html_title_written = 1;
}
}
@@ -135,6 +139,34 @@ escape_string (string)
free (string);
return newstring - newlen;
}
+
+/* Save current tag. */
+void
+push_tag (tag)
+ char *tag;
+{
+ HSTACK *newstack = xmalloc (sizeof (HSTACK));
+
+ newstack->tag = tag;
+ newstack->next = htmlstack;
+ htmlstack = newstack;
+}
+
+/* Get last tag. */
+void
+pop_tag ()
+{
+ HSTACK *tos = htmlstack;
+
+ if (!tos)
+ {
+ line_error (_("[unexpected] no html tag to pop"));
+ return;
+ }
+
+ htmlstack = htmlstack->next;
+ free (tos);
+}
/* Open or close TAG according to START_OR_END. */
void
@@ -142,6 +174,9 @@ insert_html_tag (start_or_end, tag)
int start_or_end;
char *tag;
{
+ char *old_tag = NULL;
+ int do_return = 0;
+
if (!paragraph_is_open && (start_or_end == START))
{
/* Need to compensate for the <p> we are about to insert, or
@@ -150,11 +185,47 @@ insert_html_tag (start_or_end, tag)
adjust_braces_following (output_paragraph_offset, 3);
add_word ("<p>");
}
- add_char ('<');
+
if (start_or_end != START)
- add_char ('/');
- add_word (tag);
- add_char ('>');
+ pop_tag (tag);
+
+ if (htmlstack)
+ old_tag = htmlstack->tag;
+
+ if (htmlstack
+ && (strcmp (htmlstack->tag, tag) == 0))
+ do_return = 1;
+
+ if (start_or_end == START)
+ push_tag (tag);
+
+ if (do_return)
+ return;
+
+ /* texinfo.tex doesn't support more than one font attribute
+ at the same time. */
+ if ((start_or_end == START) && old_tag && *old_tag)
+ {
+ add_word ("</");
+ add_word (old_tag);
+ add_char ('>');
+ }
+
+ if (*tag)
+ {
+ add_char ('<');
+ if (start_or_end != START)
+ add_char ('/');
+ add_word (tag);
+ add_char ('>');
+ }
+
+ if ((start_or_end != START) && old_tag && *old_tag)
+ {
+ add_char ('<');
+ add_word (old_tag);
+ add_char ('>');
+ }
}
/* Output an HTML <link> to the filename for NODE, including the
@@ -295,8 +366,8 @@ nodename_to_filename_1 (nodename, href)
p = strchr (nodename, ')');
if (p == NULL)
{
- line_error (_("Invalid node name: `%s'"), nodename);
- exit (1);
+ line_error (_("[unexpected] invalid node name: `%s'"), nodename);
+ xexit (1);
}
length = p - nodename - 1;
diff --git a/contrib/texinfo/makeinfo/html.h b/contrib/texinfo/makeinfo/html.h
index 735b531..84960db 100644
--- a/contrib/texinfo/makeinfo/html.h
+++ b/contrib/texinfo/makeinfo/html.h
@@ -1,7 +1,7 @@
/* html.h -- declarations for html-related utilities.
- $Id: html.h,v 1.4 2002/03/18 19:45:18 karl Exp $
+ $Id: html.h,v 1.4 2002/10/31 22:08:23 karl Exp $
- Copyright (C) 1999, 2000, 02 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,9 +20,19 @@
#ifndef HTML_H
#define HTML_H
+/* A stack of font tags. */
+typedef struct hstack
+{
+ struct hstack *next;
+ char *tag;
+} HSTACK;
+
/* Nonzero if we have output the <head>. */
extern int html_output_head_p;
+/* Nonzero if we have output a title, from @titlefont or @settitle. */
+extern int html_title_written;
+
/* Perform the <head> output. */
extern void html_output_head ();
diff --git a/contrib/texinfo/makeinfo/index.c b/contrib/texinfo/makeinfo/index.c
index bed915d..05c883c 100644
--- a/contrib/texinfo/makeinfo/index.c
+++ b/contrib/texinfo/makeinfo/index.c
@@ -1,7 +1,7 @@
/* index.c -- indexing for Texinfo.
- $Id: index.c,v 1.25 2002/03/19 14:43:04 karl Exp $
+ $Id: index.c,v 1.4 2002/11/26 22:54:31 karl Exp $
- Copyright (C) 1998, 99, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -334,7 +334,6 @@ init_indices ()
/* If there were existing indices, get rid of them now. */
for (i = 0; i < defined_indices; i++)
{
- undefindex (name_index_alist[i]->name);
if (name_index_alist[i])
{ /* Suppose we're called with two input files, and the first
does a @synindex pg cp. Then, when we get here to start
@@ -342,6 +341,7 @@ init_indices ()
undefindex (because it's pointing to "cp"). So free it
here; otherwise, when we try to define the pg index again
just below, it will still point to cp. */
+ undefindex (name_index_alist[i]->name);
free (name_index_alist[i]->name);
free (name_index_alist[i]);
name_index_alist[i] = NULL;
@@ -597,7 +597,7 @@ sort_index (index)
/* If this particular entry should be printed as a "code" index,
then expand it as @code{entry}, i.e. as in fixed-width font. */
array[count-1]->entry = expansion (temp->entry_text,
- array[count-1]->code);
+ array[count-1]->code);
temp = temp->next;
}
@@ -662,18 +662,18 @@ cm_printindex ()
index = index_list (index_name);
if (index == (INDEX_ELT *)-1)
- {
- line_error (_("Unknown index `%s' in @printindex"), index_name);
- free (index_name);
- return;
- }
+ {
+ line_error (_("Unknown index `%s' in @printindex"), index_name);
+ free (index_name);
+ return;
+ }
/* Do this before sorting, so execute_string is in the good environment */
if (xml && docbook)
- xml_begin_index ();
+ xml_begin_index ();
/* Do this before sorting, so execute_string in index_element_compare
- will give the same results as when we actually print. */
+ will give the same results as when we actually print. */
printing_index = 1;
filling_enabled = 0;
inhibit_paragraph_indentation = 1;
@@ -682,9 +682,9 @@ cm_printindex ()
xml_sort_index = 0;
close_paragraph ();
if (html)
- add_word ("<ul compact>");
+ add_word_args ("<ul class=\"index-%s\" compact>", index_name);
else if (!no_headers && !docbook)
- add_word ("* Menu:\n\n");
+ add_word ("* Menu:\n\n");
me_inhibit_expansion++;
@@ -693,150 +693,154 @@ cm_printindex ()
line = xmalloc (line_length);
for (item = 0; (index = array[item]); item++)
- {
- /* A pathological document might have an index entry outside of any
- node. Don't crash; try using the section name instead. */
- char *index_node = index->node;
-
- line_number = index->defining_line;
- input_filename = index->defining_file;
-
- if ((!index_node || !*index_node) && html)
- index_node = toc_find_section_of_node (index_node);
-
- if (!index_node || !*index_node)
- {
- line_error (_("Entry for index `%s' outside of any node"),
- index_name);
- if (html || !no_headers)
- index_node = _("(outside of any node)");
- }
-
- if (html)
- /* fixme: html: we should use specific index anchors pointing
+ {
+ /* A pathological document might have an index entry outside of any
+ node. Don't crash; try using the section name instead. */
+ char *index_node = index->node;
+
+ line_number = index->defining_line;
+ input_filename = index->defining_file;
+
+ if ((!index_node || !*index_node) && html)
+ index_node = toc_find_section_of_node (index_node);
+
+ if (!index_node || !*index_node)
+ {
+ line_error (_("Entry for index `%s' outside of any node"),
+ index_name);
+ if (html || !no_headers)
+ index_node = _("(outside of any node)");
+ }
+
+ if (html)
+ /* fixme: html: we should use specific index anchors pointing
to the actual location of the indexed position (but then we
have to find something to wrap the anchor around). */
- {
- if (last_index
- && STREQ (last_index->entry_text, index->entry_text))
- add_word (", "); /* Don't repeat the previous entry. */
- else
- {
- /* In the HTML case, the expanded index entry is not
- good for us, since it was expanded for non-HTML mode
- inside sort_index. So we need to HTML-escape and
- expand the original entry text here. */
- char *escaped_entry = xstrdup (index->entry_text);
- char *expanded_entry;
-
- /* expansion() doesn't HTML-escape the argument, so need
- to do it separately. */
- escaped_entry = escape_string (escaped_entry);
- expanded_entry = expansion (escaped_entry, index->code);
- add_word_args ("\n<li>%s: ", expanded_entry);
- free (escaped_entry);
- free (expanded_entry);
- }
- add_word ("<a href=\"");
- if (index->node && *index->node)
- {
- /* Make sure any non-macros in the node name are expanded. */
- in_fixed_width_font++;
- index_node = expansion (index_node, 0);
- in_fixed_width_font--;
- add_anchor_name (index_node, 1);
- add_word_args ("\">%s</a>", index_node);
- free (index_node);
- }
- else if (STREQ (index_node, _("(outside of any node)")))
- {
- add_anchor_name (index_node, 1);
- add_word_args ("\">%s</a>", index_node);
- }
- else
- /* If we use the section instead of the (missing) node, then
- index_node already includes all we need except the #. */
- add_word_args ("#%s</a>", index_node);
- }
- else if (xml && docbook)
- {
- xml_insert_indexentry (index->entry, index_node);
- }
- else
- {
- unsigned new_length = strlen (index->entry);
-
- if (new_length < 50) /* minimum length used below */
- new_length = 50;
- new_length += strlen (index_node) + 7; /* * : .\n\0 */
-
- if (new_length > line_length)
- {
- line_length = new_length;
- line = xrealloc (line, line_length);
- }
- /* Print the entry, nicely formatted. We've already
- expanded any commands in index->entry, including any
- implicit @code. Thus, can't call execute_string, since
- @@ has turned into @. */
- if (!no_headers)
- {
- sprintf (line, "* %-37s ", index->entry);
- line[2 + strlen (index->entry)] = ':';
- insert_string (line);
- /* Make sure any non-macros in the node name are expanded. */
- in_fixed_width_font++;
- execute_string ("%s.\n", index_node);
- in_fixed_width_font--;
- }
- else
- {
- /* With --no-headers, the @node lines are gone, so
- there's little sense in referring to them in the
- index. Instead, output the number or name of the
- section that corresponds to that node. */
- char *section_name = toc_find_section_of_node (index_node);
-
- sprintf (line, "%-*s ", number_sections ? 50 : 1, index->entry);
- line[strlen (index->entry)] = ':';
- insert_string (line);
- if (section_name)
- {
- int idx = 0;
- unsigned ref_len = strlen (section_name) + 30;
-
- if (ref_len > line_length)
- {
- line_length = ref_len;
- line = xrealloc (line, line_length);
- }
-
- if (number_sections)
- {
- while (section_name[idx]
- && (isdigit (section_name[idx])
- || (idx && section_name[idx] == '.')))
- idx++;
- }
- if (idx)
- sprintf (line, " See %.*s.\n", idx, section_name);
- else
- sprintf (line, "\n See ``%s''.\n", section_name);
- insert_string (line);
- }
- else
- {
- insert_string (" "); /* force a blank */
- execute_string ("See node %s.\n", index_node);
- }
- }
- }
-
- /* Prevent `output_paragraph' from growing to the size of the
- whole index. */
- flush_output ();
- last_index = index;
- }
+ {
+ if (last_index
+ && STREQ (last_index->entry_text, index->entry_text))
+ add_word (", "); /* Don't repeat the previous entry. */
+ else
+ {
+ /* In the HTML case, the expanded index entry is not
+ good for us, since it was expanded for non-HTML mode
+ inside sort_index. So we need to HTML-escape and
+ expand the original entry text here. */
+ char *escaped_entry = xstrdup (index->entry_text);
+ char *expanded_entry;
+
+ /* expansion() doesn't HTML-escape the argument, so need
+ to do it separately. */
+ escaped_entry = escape_string (escaped_entry);
+ expanded_entry = expansion (escaped_entry, index->code);
+ add_word_args ("\n<li>%s: ", expanded_entry);
+ free (escaped_entry);
+ free (expanded_entry);
+ }
+ add_word ("<a href=\"");
+ if (index->node && *index->node)
+ {
+ /* Make sure any non-macros in the node name are expanded. */
+ in_fixed_width_font++;
+ index_node = expansion (index_node, 0);
+ in_fixed_width_font--;
+ add_anchor_name (index_node, 1);
+ add_word_args ("\">%s</a>", index_node);
+ free (index_node);
+ }
+ else if (STREQ (index_node, _("(outside of any node)")))
+ {
+ add_anchor_name (index_node, 1);
+ add_word_args ("\">%s</a>", index_node);
+ }
+ else
+ /* If we use the section instead of the (missing) node, then
+ index_node already includes all we need except the #. */
+ add_word_args ("#%s</a>", index_node);
+ }
+ else if (xml && docbook)
+ {
+ /* 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
+ {
+ unsigned new_length = strlen (index->entry);
+
+ if (new_length < 50) /* minimum length used below */
+ new_length = 50;
+ new_length += strlen (index_node) + 7; /* * : .\n\0 */
+
+ if (new_length > line_length)
+ {
+ line_length = new_length;
+ line = xrealloc (line, line_length);
+ }
+ /* Print the entry, nicely formatted. We've already
+ expanded any commands in index->entry, including any
+ implicit @code. Thus, can't call execute_string, since
+ @@ has turned into @. */
+ if (!no_headers)
+ {
+ sprintf (line, "* %-37s ", index->entry);
+ line[2 + strlen (index->entry)] = ':';
+ insert_string (line);
+ /* Make sure any non-macros in the node name are expanded. */
+ in_fixed_width_font++;
+ execute_string ("%s.\n", index_node);
+ in_fixed_width_font--;
+ }
+ else
+ {
+ /* With --no-headers, the @node lines are gone, so
+ there's little sense in referring to them in the
+ index. Instead, output the number or name of the
+ section that corresponds to that node. */
+ char *section_name = toc_find_section_of_node (index_node);
+
+ sprintf (line, "%-*s ", number_sections ? 50 : 1, index->entry);
+ line[strlen (index->entry)] = ':';
+ insert_string (line);
+ if (section_name)
+ {
+ int idx = 0;
+ unsigned ref_len = strlen (section_name) + 30;
+
+ if (ref_len > line_length)
+ {
+ line_length = ref_len;
+ line = xrealloc (line, line_length);
+ }
+
+ if (number_sections)
+ {
+ while (section_name[idx]
+ && (isdigit (section_name[idx])
+ || (idx && section_name[idx] == '.')))
+ idx++;
+ }
+ if (idx)
+ sprintf (line, " See %.*s.\n", idx, section_name);
+ else
+ sprintf (line, "\n See ``%s''.\n", section_name);
+ insert_string (line);
+ }
+ else
+ {
+ insert_string (" "); /* force a blank */
+ execute_string ("See node %s.\n", index_node);
+ }
+ }
+ }
+
+ /* Prevent `output_paragraph' from growing to the size of the
+ whole index. */
+ flush_output ();
+ last_index = index;
+ }
free (line);
free (index_name);
@@ -852,8 +856,8 @@ cm_printindex ()
line_number = saved_line_number;
if (html)
- add_word ("</ul>");
+ add_word ("</ul>");
else if (xml && docbook)
- xml_end_index ();
+ xml_end_index ();
}
}
diff --git a/contrib/texinfo/makeinfo/index.h b/contrib/texinfo/makeinfo/index.h
index ed8583a..3279a24 100644
--- a/contrib/texinfo/makeinfo/index.h
+++ b/contrib/texinfo/makeinfo/index.h
@@ -1,5 +1,5 @@
/* index.h -- declarations for index.c.
- $Id: index.h,v 1.4 1999/04/19 18:12:17 karl Exp $
+ $Id: index.h,v 1.1 2002/08/25 23:38:38 karl Exp $
Copyright (C) 1998, 99 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/insertion.c b/contrib/texinfo/makeinfo/insertion.c
index 30a0222..ecc0f66 100644
--- a/contrib/texinfo/makeinfo/insertion.c
+++ b/contrib/texinfo/makeinfo/insertion.c
@@ -1,7 +1,8 @@
/* insertion.c -- insertions for Texinfo.
- $Id: insertion.c,v 1.47 2002/04/01 14:01:36 karl Exp $
+ $Id: insertion.c,v 1.14 2003/01/02 23:46:29 karl Exp $
- Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,8 +35,8 @@ static char *insertion_type_names[] =
"deftypevar", "deftypevr", "defun", "defvar", "defvr", "detailmenu",
"direntry", "display", "documentdescription", "enumerate", "example",
"flushleft", "flushright", "format", "ftable", "group", "ifclear",
- "ifhtml", "ifinfo", "ifnothtml", "ifnotinfo", "ifnotplaintext", "ifnottex",
- "ifplaintext", "ifset", "iftex", "itemize", "lisp", "menu",
+ "ifhtml", "ifinfo", "ifnothtml", "ifnotinfo", "ifnotplaintext", "ifnottex", "ifnotxml",
+ "ifplaintext", "ifset", "iftex", "ifxml", "itemize", "lisp", "menu",
"multitable", "quotation", "rawhtml", "rawtex", "smalldisplay",
"smallexample", "smallformat", "smalllisp", "verbatim", "table",
"tex", "vtable", "bad_type"
@@ -100,15 +101,17 @@ current_item_function ()
case ifnotinfo:
case ifnotplaintext:
case ifnottex:
+ case ifnotxml:
case ifplaintext:
case ifset:
case iftex:
+ case ifxml:
case rawhtml:
case rawtex:
case tex:
case cartouche:
- elt = elt->next;
- break;
+ elt = elt->next;
+ break;
default:
done = 1;
@@ -211,6 +214,8 @@ find_type_from_name (name)
return (enum insertion_type) index;
if (index == rawhtml && STREQ (name, "html"))
return rawhtml;
+ if (index == rawhtml && STREQ (name, "xml"))
+ return rawhtml;
if (index == rawtex && STREQ (name, "tex"))
return rawtex;
index++;
@@ -386,7 +391,7 @@ begin_insertion (type)
add_word ("* Menu:\n");
if (xml)
- xml_insert_element (MENU, START);
+ xml_insert_element (MENU, START);
next_menu_item_number = 1;
in_menu++;
@@ -443,14 +448,23 @@ begin_insertion (type)
the Top node (for info/html). */
char *text;
int start_of_end;
+ int save_paragraph_indentation;
discard_until ("\n"); /* ignore remainder of @copying line */
start_of_end = get_until ("\n@end copying", &text);
/* include all the output-format-specific markup. */
+ if (docbook)
+ {
+ save_paragraph_indentation = inhibit_paragraph_indentation;
+ inhibit_paragraph_indentation = 1;
+ }
copying_text = full_expansion (text, 0);
free (text);
+ if (docbook)
+ inhibit_paragraph_indentation = save_paragraph_indentation;
+
input_text_offset = start_of_end; /* go back to the @end to match */
}
@@ -461,8 +475,26 @@ begin_insertion (type)
For html, we output it specifically in html_output_head.
For plain text, there's no way to hide it, so the author must
use @insertcopying in the desired location. */
+ if (docbook)
+ {
+ if (!xml_in_bookinfo)
+ {
+ xml_insert_element (BOOKINFO, START);
+ xml_in_bookinfo = 1;
+ }
+ if (!xml_in_abstract)
+ {
+ xml_insert_element (ABSTRACT, START);
+ xml_in_abstract = 1;
+ }
+ }
if (!html && !no_headers)
cm_insert_copying ();
+ if (docbook && xml_in_abstract)
+ {
+ xml_insert_element (ABSTRACT, END);
+ xml_in_abstract = 0;
+ }
break;
case quotation:
@@ -500,10 +532,21 @@ begin_insertion (type)
/* Kludge alert: if <pre> is followed by a newline, IE3
renders an extra blank line before the pre-formatted block.
Other browsers seem to not mind one way or the other. */
- add_word ("<br><pre>");
+ add_word_args ("<pre class=\"%s\">", command);
if (type != format && type != smallformat)
- current_indent += default_indentation_increment;
+ {
+ current_indent += default_indentation_increment;
+ if (html)
+ {
+ /* Since we didn't put \n after <pre>, we need to insert
+ the indentation by hand. */
+ int i;
+ for (i = current_indent; i > 0; i--)
+ add_char (' ');
+ }
+ }
+
break;
case multitable:
@@ -542,15 +585,15 @@ begin_insertion (type)
if (html)
{
if (type == itemize)
- {
- add_word ("<ul>\n");
- in_paragraph = 0;
- }
+ {
+ add_word ("<ul>\n");
+ in_paragraph = 0;
+ }
else
add_word (dl_tag);
}
if (xml)
- xml_begin_table (type, insertion_stack->item_function);
+ xml_begin_table (type, insertion_stack->item_function);
break;
case enumerate:
@@ -566,10 +609,13 @@ begin_insertion (type)
filling_enabled = indented_fill = 1;
if (html)
- enum_html ();
+ {
+ enum_html ();
+ in_paragraph = 0;
+ }
if (xml)
- xml_begin_enumerate (enumeration_arg);
+ xml_begin_enumerate (enumeration_arg);
if (isdigit (*enumeration_arg))
start_enumerating (atoi (enumeration_arg), ENUM_DIGITS);
@@ -582,7 +628,7 @@ begin_insertion (type)
/* Only close the paragraph if we are not inside of an
@example-like environment. */
if (xml)
- xml_insert_element (GROUP, START);
+ xml_insert_element (GROUP, START);
else if (!insertion_stack->next
|| (insertion_stack->next->insertion != display
&& insertion_stack->next->insertion != smalldisplay
@@ -606,9 +652,11 @@ begin_insertion (type)
case ifnotinfo:
case ifnotplaintext:
case ifnottex:
+ case ifnotxml:
case ifplaintext:
case ifset:
case iftex:
+ case ifxml:
case rawtex:
if (in_menu)
no_discard++;
@@ -648,7 +696,7 @@ begin_insertion (type)
inhibit_paragraph_indentation = 1;
filling_enabled = indented_fill = no_indent = 0;
if (html)
- add_word ("<div align=\"left\">");
+ add_word ("<div align=\"left\">");
break;
case flushright:
@@ -657,7 +705,7 @@ begin_insertion (type)
inhibit_paragraph_indentation = 1;
force_flush_right++;
if (html)
- add_word ("<div align=\"right\">");
+ add_word ("<div align=\"right\">");
break;
default:
@@ -700,56 +748,62 @@ end_insertion (type)
if (xml)
{
switch (type)
- {
- case ifinfo:
- case documentdescription:
- break;
- case copying:
- xml_insert_element (COPYING, END);
- break;
- case quotation:
- xml_insert_element (QUOTATION, END);
- break;
- case example:
- xml_insert_element (EXAMPLE, END);
- break;
- case smallexample:
- xml_insert_element (SMALLEXAMPLE, END);
- break;
- case lisp:
- xml_insert_element (LISP, END);
- break;
- case smalllisp:
- xml_insert_element (SMALLLISP, END);
- break;
- case cartouche:
- xml_insert_element (CARTOUCHE, END);
- break;
- case format:
- xml_insert_element (FORMAT, END);
- break;
- case smallformat:
- xml_insert_element (SMALLFORMAT, END);
- break;
- case display:
- xml_insert_element (DISPLAY, END);
- break;
- case smalldisplay:
- xml_insert_element (SMALLDISPLAY, END);
- break;
- case table:
- case ftable:
- case vtable:
- case itemize:
- xml_end_table (type);
- break;
- case enumerate:
- xml_end_enumerate (type);
- break;
- case group:
- xml_insert_element (GROUP, END);
- break;
- }
+ {
+ case ifinfo:
+ case documentdescription:
+ break;
+ case copying:
+ xml_insert_element (COPYING, END);
+ break;
+ case quotation:
+ xml_insert_element (QUOTATION, END);
+ break;
+ case example:
+ xml_insert_element (EXAMPLE, END);
+ break;
+ case smallexample:
+ xml_insert_element (SMALLEXAMPLE, END);
+ break;
+ case lisp:
+ xml_insert_element (LISP, END);
+ break;
+ case smalllisp:
+ xml_insert_element (SMALLLISP, END);
+ break;
+ case cartouche:
+ xml_insert_element (CARTOUCHE, END);
+ break;
+ case format:
+ if (docbook && xml_in_bookinfo && xml_in_abstract)
+ {
+ xml_insert_element (ABSTRACT, END);
+ xml_in_abstract = 0;
+ }
+ else
+ xml_insert_element (FORMAT, END);
+ break;
+ case smallformat:
+ xml_insert_element (SMALLFORMAT, END);
+ break;
+ case display:
+ xml_insert_element (DISPLAY, END);
+ break;
+ case smalldisplay:
+ xml_insert_element (SMALLDISPLAY, END);
+ break;
+ case table:
+ case ftable:
+ case vtable:
+ case itemize:
+ xml_end_table (type);
+ break;
+ case enumerate:
+ xml_end_enumerate (type);
+ break;
+ case group:
+ xml_insert_element (GROUP, END);
+ break;
+ }
}
switch (type)
{
@@ -763,9 +817,11 @@ end_insertion (type)
case ifnotinfo:
case ifnotplaintext:
case ifnottex:
+ case ifnotxml:
case ifplaintext:
case ifset:
case iftex:
+ case ifxml:
case rawtex:
break;
@@ -809,7 +865,7 @@ end_insertion (type)
case flushleft:
if (html)
- add_word ("</div>\n");
+ add_word ("</div>\n");
close_insertion_paragraph ();
break;
@@ -846,6 +902,7 @@ end_insertion (type)
current_indent -= default_indentation_increment;
if (html)
add_word ("</dl>\n");
+ close_insertion_paragraph ();
break;
case itemize:
@@ -858,14 +915,14 @@ end_insertion (type)
case flushright:
force_flush_right--;
if (html)
- add_word ("</div>\n");
+ add_word ("</div>\n");
close_insertion_paragraph ();
break;
/* Handle the @defun insertions with this default clause. */
default:
{
- enum insertion_type base_type;
+ enum insertion_type base_type;
if (type < defcv || type > defvr)
line_error ("end_insertion internal error: type=%d", type);
@@ -880,11 +937,11 @@ end_insertion (type)
case deftypevr:
case defcv:
case defop:
- case deftypemethod:
- case deftypeop:
- case deftypeivar:
- if (html)
- /* close the tables which has been opened in defun.c */
+ case deftypemethod:
+ case deftypeop:
+ case deftypeivar:
+ if (html)
+ /* close the tables which has been opened in defun.c */
add_word ("</td></tr>\n</table>\n");
break;
} /* switch (base_type)... */
@@ -927,9 +984,9 @@ discard_insertions (specials_ok)
char *offender = insertion_type_pname (insertion_stack->insertion);
file_line_error (insertion_stack->filename,
- insertion_stack->line_number,
- _("No matching `%cend %s'"), COMMAND_PREFIX,
- offender);
+ insertion_stack->line_number,
+ _("No matching `%cend %s'"), COMMAND_PREFIX,
+ offender);
pop_insertion ();
}
}
@@ -1003,6 +1060,10 @@ cm_insert_copying ()
full expansion on copying_text when we saved it. */
insert_string (copying_text);
insert ('\n');
+
+ /* Update output_position so that the node positions in the tag
+ tables will take account of the copying text. */
+ flush_output ();
}
}
@@ -1010,7 +1071,15 @@ void
cm_format ()
{
if (xml)
- xml_insert_element (FORMAT, START);
+ {
+ if (docbook && xml_in_bookinfo)
+ {
+ xml_insert_element (ABSTRACT, START);
+ xml_in_abstract = 1;
+ }
+ else
+ xml_insert_element (FORMAT, START);
+ }
begin_insertion (format);
}
@@ -1129,7 +1198,7 @@ handle_verbatim_environment (find_end_verbatim)
*/
if (html)
- add_word ("<pre>");
+ add_word ("<pre class=\"verbatim\">");
while (input_text_offset < input_text_length)
{
@@ -1138,19 +1207,25 @@ handle_verbatim_environment (find_end_verbatim)
if (character == '\n')
line_number++;
/*
- Assume no newlines in END_VERBATIM
+ Assume no newlines in END_VERBATIM
*/
else if (find_end_verbatim && (character == COMMAND_PREFIX) /* @ */
- && (input_text_length - input_text_offset > sizeof (END_VERBATIM))
- && !strncmp (&input_text[input_text_offset+1], END_VERBATIM,
- sizeof (END_VERBATIM)-1))
- {
- input_text_offset += sizeof (END_VERBATIM);
- seen_end = 1;
- break;
- }
+ && (input_text_length - input_text_offset > sizeof (END_VERBATIM))
+ && !strncmp (&input_text[input_text_offset+1], END_VERBATIM,
+ sizeof (END_VERBATIM)-1))
+ {
+ input_text_offset += sizeof (END_VERBATIM);
+ seen_end = 1;
+ break;
+ }
+
+ if (html && character == '&' && escape_html)
+ add_word ("&amp;");
+ else if (html && character == '<' && escape_html)
+ add_word ("&lt;");
+ else
+ add_char (character);
- add_char (character);
input_text_offset++;
}
@@ -1205,7 +1280,7 @@ cm_group ()
void
cm_html ()
{
- if (process_html)
+ if (process_html || process_xml)
begin_insertion (rawhtml);
else
command_name_condition ();
@@ -1294,6 +1369,25 @@ cm_ifnottex ()
else
command_name_condition ();
}
+
+void
+cm_ifxml ()
+{
+ if (process_xml)
+ begin_insertion (ifxml);
+ else
+ command_name_condition ();
+}
+
+void
+cm_ifnotxml ()
+{
+ if (!process_xml)
+ begin_insertion (ifnotxml);
+ else
+ command_name_condition ();
+}
+
/* Begin an insertion where the lines are not filled or indented. */
void
@@ -1425,9 +1519,11 @@ cm_item ()
case ifnotinfo:
case ifnotplaintext:
case ifnottex:
+ case ifnotxml:
case ifplaintext:
case ifset:
case iftex:
+ case ifxml:
case rawhtml:
case rawtex:
case tex:
@@ -1465,16 +1561,16 @@ cm_item ()
else
{
if (html)
- {
- if (in_paragraph)
- {
- add_word ("</p>");
- in_paragraph = 0;
- }
- add_word ("<li>");
- }
- else if (xml)
- xml_begin_item ();
+ {
+ if (in_paragraph)
+ {
+ add_word ("</p>");
+ in_paragraph = 0;
+ }
+ add_word ("<li>");
+ }
+ else if (xml)
+ xml_begin_item ();
else
{
start_paragraph ();
@@ -1513,12 +1609,12 @@ cm_item ()
must_start_paragraph = 1;
}
- /* Handle text directly after the @item. */
- if (*rest_of_line)
- {
- line_number--;
- input_text_offset = original_input_text_offset;
- }
+ /* Handle text directly after the @item. */
+ if (*rest_of_line)
+ {
+ line_number--;
+ input_text_offset = original_input_text_offset;
+ }
}
break;
@@ -1539,7 +1635,7 @@ cm_item ()
output_paragraph_offset = 0;
/* Force the browser to render one blank line before
- each new @item in a table. But don't do that unless
+ each new @item in a table. But don't do that if
this is the first <dt> after the <dl>, or if we are
converting @itemx.
@@ -1569,15 +1665,15 @@ cm_item ()
last_html_output_position = output_position;
add_word ("<dd>");
}
- else if (xml) /* && docbook)*/ /* 05-08 */
- {
- xml_begin_table_item ();
+ else if (xml) /* && docbook)*/ /* 05-08 */
+ {
+ xml_begin_table_item ();
if (item_func && *item_func)
execute_string ("%s{%s}", item_func, rest_of_line);
else
execute_string ("%s", rest_of_line);
- xml_continue_table_item ();
- }
+ xml_continue_table_item ();
+ }
else
{
/* We need this to determine if we have two @item's in a row
diff --git a/contrib/texinfo/makeinfo/insertion.h b/contrib/texinfo/makeinfo/insertion.h
index 3a8ccb9..17916e7 100644
--- a/contrib/texinfo/makeinfo/insertion.h
+++ b/contrib/texinfo/makeinfo/insertion.h
@@ -1,7 +1,7 @@
/* insertion.h -- declarations for insertion.c.
- $Id: insertion.h,v 1.13 2002/03/28 16:33:48 karl Exp $
+ $Id: insertion.h,v 1.2 2002/09/29 19:15:20 karl Exp $
- Copyright (C) 1998, 99, 2001, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,8 +28,8 @@ enum insertion_type
deftypemethod, deftypeop, deftypevar, deftypevr, defun, defvar, defvr,
detailmenu, direntry, display, documentdescription, enumerate,
example, flushleft, flushright, format, ftable, group, ifclear,
- ifhtml, ifinfo, ifnothtml, ifnotinfo, ifnotplaintext, ifnottex,
- ifplaintext, ifset, iftex, itemize, lisp, menu, multitable, quotation,
+ ifhtml, ifinfo, ifnothtml, ifnotinfo, ifnotplaintext, ifnottex, ifnotxml,
+ ifplaintext, ifset, iftex, ifxml, itemize, lisp, menu, multitable, quotation,
rawhtml, rawtex, smalldisplay, smallexample, smallformat, smalllisp,
verbatim, table, tex, vtable, bad_type
};
@@ -60,4 +60,5 @@ extern void cm_ifhtml (), cm_ifnothtml(), cm_html ();
extern void cm_ifinfo (), cm_ifnotinfo ();
extern void cm_ifplaintext (), cm_ifnotplaintext();
extern void cm_iftex (), cm_ifnottex (), cm_tex ();
+extern void cm_ifxml (), cm_ifnotxml ();
#endif /* !INSERTION_H */
diff --git a/contrib/texinfo/makeinfo/lang.c b/contrib/texinfo/makeinfo/lang.c
index 468bed8..a9cbfe1 100644
--- a/contrib/texinfo/makeinfo/lang.c
+++ b/contrib/texinfo/makeinfo/lang.c
@@ -1,7 +1,7 @@
/* lang.c -- language-dependent support.
- $Id: lang.c,v 1.14 2001/09/11 18:04:35 karl Exp $
+ $Id: lang.c,v 1.5 2002/11/12 18:48:52 feloy Exp $
- Copyright (C) 1999, 2000, 01 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@ encoding_code_type document_encoding_code = no_encoding;
/* Current language code; default is English. */
language_code_type language_code = en;
+iso_map_type us_ascii_map [] = {{NULL, 0, 0}}; /* ASCII map is trivial */
+
/* Translation table between HTML and ISO Codes. The last item is
hopefully the Unicode. It might be possible that those Unicodes are
not correct, cause I didn't check them. kama */
@@ -131,16 +133,13 @@ iso_map_type iso8859_1_map [] = {
{ "uuml", 0xFC, 0x00FC },
{ "yacute", 0xFD, 0x00FD },
{ "thorn", 0xFE, 0x00FE },
- { "yuml", 0xFF, 0x00FF }
+ { "yuml", 0xFF, 0x00FF },
+ { NULL, 0, 0 }
};
-/* This might be put into structure below and NOT coded via define,
- because some translation tables could contain different numbers of
- characters, but for now it suffices. */
-#define ISO_MAP_SIZE (sizeof (iso8859_1_map) / sizeof (iso8859_1_map[0]))
-
encoding_type encoding_table[] = {
{ no_encoding, "(no encoding)", NULL },
+ { US_ASCII, "US-ASCII", us_ascii_map },
{ ISO_8859_1, "ISO-8859-1", (iso_map_type *) iso8859_1_map },
{ ISO_8859_2, "ISO-8859-2", NULL },
{ ISO_8859_3, "ISO-8859-3", NULL },
@@ -349,7 +348,7 @@ cm_search_iso_map (html)
if (!iso)
return -1;
- for (i = 0; i < ISO_MAP_SIZE; i++)
+ for (i = 0; iso[i].html; i++)
{
if (strcmp (html, iso[i].html) == 0)
return i;
@@ -370,7 +369,7 @@ cm_documentencoding ()
get_rest_of_line (1, &enc_arg);
/* See if we have this encoding. */
- for (enc = ISO_8859_1; enc != last_encoding_code; enc++)
+ for (enc = no_encoding+1; enc != last_encoding_code; enc++)
{
if (strcasecmp (enc_arg, encoding_table[enc].ecname) == 0)
{
@@ -400,8 +399,10 @@ add_encoded_char (html_str, info_str)
char *html_str;
char *info_str;
{
- if (html || xml)
+ if (html)
add_word_args ("&%s;", html_str);
+ else if (xml)
+ xml_insert_entity (html_str);
else if (enable_encoding)
{
/* Look for HTML_STR in the current translation table. */
@@ -439,15 +440,21 @@ cm_accent_generic_html (arg, start, end, html_supported, single,
if (strchr (html_supported, curchar ()))
{ /* Yes; start with an ampersand. The character itself
will be added later in read_command (makeinfo.c). */
+ int saved_escape_html = escape_html;
+ escape_html = 0;
valid_html_accent = 1;
add_char ('&');
+ escape_html = saved_escape_html;
}
else
{
valid_html_accent = 0;
if (html_solo_standalone)
{ /* No special HTML support, so produce standalone char. */
- add_word_args ("&%s;", html_solo);
+ if (xml)
+ xml_insert_entity (html_solo);
+ else
+ add_word_args ("&%s;", html_solo);
}
else
/* If the html_solo does not exist as standalone character
diff --git a/contrib/texinfo/makeinfo/lang.h b/contrib/texinfo/makeinfo/lang.h
index 57d4946..b78ce9c 100644
--- a/contrib/texinfo/makeinfo/lang.h
+++ b/contrib/texinfo/makeinfo/lang.h
@@ -1,7 +1,7 @@
/* lang.h -- declarations for language codes etc.
- $Id: lang.h,v 1.7 2001/09/11 18:04:29 karl Exp $
+ $Id: lang.h,v 1.3 2002/11/07 16:10:49 karl Exp $
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -79,6 +79,7 @@ extern language_type language_table[];
*/
typedef enum {
no_encoding,
+ US_ASCII,
ISO_8859_1, /* default for en, de, */
ISO_8859_2, /* actualy not supported like the rest below */
ISO_8859_3,
diff --git a/contrib/texinfo/makeinfo/macro.c b/contrib/texinfo/makeinfo/macro.c
index 2bba378..357d4ac 100644
--- a/contrib/texinfo/makeinfo/macro.c
+++ b/contrib/texinfo/makeinfo/macro.c
@@ -1,7 +1,7 @@
/* macro.c -- user-defined macros for Texinfo.
- $Id: macro.c,v 1.12 2002/03/02 15:05:21 karl Exp $
+ $Id: macro.c,v 1.1 2002/08/25 23:38:38 karl Exp $
- Copyright (C) 1998, 99, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/contrib/texinfo/makeinfo/macro.h b/contrib/texinfo/makeinfo/macro.h
index a64c613..5161084 100644
--- a/contrib/texinfo/makeinfo/macro.h
+++ b/contrib/texinfo/makeinfo/macro.h
@@ -1,5 +1,5 @@
/* macro.h -- declarations for macro.c.
- $Id: macro.h,v 1.5 1999/07/15 00:00:46 karl Exp $
+ $Id: macro.h,v 1.1 2002/08/25 23:38:38 karl Exp $
Copyright (C) 1998, 99 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/makeinfo.c b/contrib/texinfo/makeinfo/makeinfo.c
index 47cc903..725e5de 100644
--- a/contrib/texinfo/makeinfo/makeinfo.c
+++ b/contrib/texinfo/makeinfo/makeinfo.c
@@ -1,8 +1,8 @@
/* makeinfo -- convert Texinfo source into other formats.
- $Id: makeinfo.c,v 1.205 2002/03/28 16:33:48 karl Exp $
+ $Id: makeinfo.c,v 1.17 2003/01/19 18:44:28 karl Exp $
- Copyright (C) 1987, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 01, 02
- Free Software Foundation, Inc.
+ Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -134,6 +134,9 @@ int do_justification = 0;
/* Nonzero means don't replace whitespace with &nbsp; in HTML mode. */
int in_html_elt = 0;
+/* True when expanding a macro definition. */
+static int executing_macro = 0;
+
typedef struct brace_element
{
struct brace_element *next;
@@ -371,7 +374,7 @@ usage (exit_value)
else
{
printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n"), progname);
- printf ("\n");
+ puts ("\n");
puts (_("\
Translate Texinfo source documentation to various other formats, by default\n\
@@ -388,17 +391,17 @@ General options:\n\
-v, --verbose explain what is being done.\n\
--version display version information and exit.\n"),
max_error_level, reference_warning_limit);
- printf ("\n");
+ puts ("\n");
/* xgettext: no-wrap */
- puts (_("\
+ puts (_("\
Output format selection (default is to produce Info):\n\
- --docbook output DocBook rather than Info.\n\
+ --docbook output DocBook XML rather than Info.\n\
--html output HTML rather than Info.\n\
- --xml output XML (TexinfoML) rather than Info.\n\
+ --xml output Texinfo XML rather than Info.\n\
"));
- puts (_("\
+ puts (_("\
General output options:\n\
-E, --macro-expand FILE output macro-expanded source to FILE.\n\
ignoring any @setfilename.\n\
@@ -412,7 +415,7 @@ General output options:\n\
-o, --output=FILE output to FILE (directory if split HTML),\n\
"));
- printf (_("\
+ printf (_("\
Options for Info and plain text:\n\
--enable-encoding output accented and special characters in\n\
Info output based on @documentencoding.\n\
@@ -427,10 +430,10 @@ Options for Info and plain text:\n\
--split-size=NUM split Info files at size NUM (default %d).\n"),
fill_column, paragraph_start_indent,
DEFAULT_SPLIT_SIZE);
- }
- printf ("\n");
- puts (_("\
+ puts ("\n");
+
+ puts (_("\
Input file options:\n\
--commands-in-node-names allow @ commands in node names.\n\
-D VAR define the variable VAR, as with @set.\n\
@@ -439,30 +442,32 @@ Input file options:\n\
-U VAR undefine the variable VAR, as with @clear.\n\
"));
- puts (_("\
+ puts (_("\
Conditional processing in input:\n\
--ifhtml process @ifhtml and @html even if not generating HTML.\n\
--ifinfo process @ifinfo even if not generating Info.\n\
--ifplaintext process @ifplaintext even if not generating plain text.\n\
--iftex process @iftex and @tex; implies --no-split.\n\
+ --ifxml process @ifxml and @xml.\n\
--no-ifhtml do not process @ifhtml and @html text.\n\
--no-ifinfo do not process @ifinfo text.\n\
--no-ifplaintext do not process @ifplaintext text.\n\
--no-iftex do not process @iftex and @tex text.\n\
+ --no-ifxml do not process @ifxml and @xml text.\n\
"));
- puts (_("\
+ puts (_("\
The defaults for the @if... conditionals depend on the output format:\n\
if generating HTML, --ifhtml is on and the others are off;\n\
if generating Info, --ifinfo is on and the others are off;\n\
if generating plain text, --ifplaintext is on and the others are off;\n\
"));
- fputs (_("\
+ fputs (_("\
Examples:\n\
makeinfo foo.texi write Info to foo's @setfilename\n\
makeinfo --html foo.texi write HTML to @setfilename\n\
- makeinfo --xml foo.texi write XML to @setfilename\n\
+ makeinfo --xml foo.texi write Texinfo XML to @setfilename\n\
makeinfo --docbook foo.texi write DocBook XML to @setfilename\n\
makeinfo --no-headers foo.texi write plain text to standard output\n\
\n\
@@ -471,11 +476,13 @@ Examples:\n\
makeinfo --no-split foo.texi write one Info file however big\n\
"), stdout);
- puts (_("\n\
+ puts (_("\n\
Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
Texinfo home page: http://www.gnu.org/software/texinfo/"));
+ } /* end of full help */
+
xexit (exit_value);
}
@@ -494,12 +501,14 @@ struct option long_options[] =
{ "ifinfo", 0, &process_info, 1 },
{ "ifplaintext", 0, &process_plaintext, 1 },
{ "iftex", 0, &process_tex, 1 },
+ { "ifxml", 0, &process_xml, 1 },
{ "macro-expand", 1, 0, 'E' },
{ "no-headers", 0, &no_headers, 1 },
{ "no-ifhtml", 0, &process_html, 0 },
{ "no-ifinfo", 0, &process_info, 0 },
{ "no-ifplaintext", 0, &process_plaintext, 0 },
{ "no-iftex", 0, &process_tex, 0 },
+ { "no-ifxml", 0, &process_xml, 0 },
{ "no-number-footnotes", 0, &number_footnotes, 0 },
{ "no-number-sections", 0, &number_sections, 0 },
{ "no-pointer-validate", 0, &validating, 0 },
@@ -559,8 +568,8 @@ main (argc, argv)
case 'd': /* --docbook */
splitting = 0;
- xml = 1;
- docbook = 1;
+ xml = 1;
+ docbook = 1;
break;
case 'e': /* --error-limit */
@@ -669,7 +678,7 @@ main (argc, argv)
footnote_style_preset = 1;
break;
- case 'S': /* --split-size */
+ case 'S': /* --split-size */
if (sscanf (optarg, "%d", &split_size) != 1)
{
fprintf (stderr,
@@ -677,7 +686,7 @@ main (argc, argv)
"--split-size", progname, optarg);
usage (1);
}
- break;
+ break;
case 'v':
verbose_mode++;
@@ -690,8 +699,8 @@ main (argc, argv)
There is NO warranty. You may redistribute this software\n\
under the terms of the GNU General Public License.\n\
For more information about these matters, see the files named COPYING.\n"),
- "2002");
- exit (0);
+ "2003");
+ xexit (0);
break;
case 'w': /* --html */
@@ -701,7 +710,8 @@ For more information about these matters, see the files named COPYING.\n"),
case 'x': /* --xml */
splitting = 0;
- xml = 1;
+ xml = 1;
+ process_xml = 1;
break;
case '?':
@@ -774,7 +784,20 @@ For more information about these matters, see the files named COPYING.\n"),
/* Hacking tokens and strings. */
-/* Return the next token as a string pointer. We cons the string. */
+/* Return the next token as a string pointer. We cons the string. This
+ `token' means simply a command name. */
+
+/* = is so @alias works. ^ and _ are so macros can be used in math mode
+ without a space following. Possibly we should simply allow alpha, to
+ be compatible with TeX. */
+#define COMMAND_CHAR(c) (!cr_or_whitespace(c) \
+ && (c) != '{' \
+ && (c) != '}' \
+ && (c) != '=' \
+ && (c) != '_' \
+ && (c) != '^' \
+ )
+
char *
read_token ()
{
@@ -798,7 +821,7 @@ read_token ()
for (i = 0; ((input_text_offset != input_text_length)
&& (character = curchar ())
- && command_char (character));
+ && COMMAND_CHAR (character));
i++, input_text_offset++);
result = xmalloc (i + 1);
memcpy (result, &input_text[input_text_offset - i], i);
@@ -1065,7 +1088,7 @@ get_rest_of_line (expand, string)
char *tem;
/* Don't expand non-macros in input, since we want them
- intact in the macro-expanded output. */
+ intact in the macro-expanded output. */
only_macro_expansion++;
get_until_in_line (1, "\n", &tem);
only_macro_expansion--;
@@ -1112,7 +1135,7 @@ get_until_in_braces (match, string)
{
if (i < input_text_length - 1 && input_text[i] == '@')
{
- i++; /* skip commands like @, and @{ */
+ i++; /* skip commands like @, and @{ */
continue;
}
else if (input_text[i] == '{')
@@ -1337,9 +1360,9 @@ insert_toplevel_subdirectory (output_filename)
free (output_filename);
output_filename = xmalloc (strlen (dir) + 1
- + strlen (basename) + 1
- + index_len
- + 1);
+ + strlen (basename) + 1
+ + index_len
+ + 1);
strcpy (output_filename, dir);
if (strlen (dir))
strcat (output_filename, "/");
@@ -1353,19 +1376,19 @@ insert_toplevel_subdirectory (output_filename)
strcat (output_filename, "/");
strcat (output_filename, basename);
if (mkdir (output_filename, 0777) == -1)
- {
- char *errmsg = strerror (errno);
+ {
+ char *errmsg = strerror (errno);
- if ((errno == EEXIST
+ if ((errno == EEXIST
#ifdef __MSDOS__
- || errno == EACCES
+ || errno == EACCES
#endif
- )
- && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
- errmsg = _("File exists, but is not a directory");
+ )
+ && (stat (output_filename, &st) == 0 && !S_ISDIR (st.st_mode)))
+ errmsg = _("File exists, but is not a directory");
line_error (_("Can't create directory `%s': %s"),
output_filename, errmsg);
- exit (1);
+ xexit (1);
}
strcat (output_filename, "/");
}
@@ -1446,7 +1469,7 @@ convert_from_loaded_file (name)
{
get_until ("\n", &output_filename); /* read rest of line */
if (xml && !docbook)
- xml_begin_document (output_filename);
+ xml_begin_document (output_filename);
if (html || xml)
{ /* Change any extension to .html or .xml. */
char *html_name, *directory_part, *basename_part, *temp;
@@ -1505,11 +1528,11 @@ convert_from_loaded_file (name)
{
if (html && splitting)
{
- if (FILENAME_CMP (output_filename, NULL_DEVICE) == 0
- || FILENAME_CMP (output_filename, ALSO_NULL_DEVICE) == 0)
- splitting = 0;
- else
- output_filename = insert_toplevel_subdirectory (output_filename);
+ if (FILENAME_CMP (output_filename, NULL_DEVICE) == 0
+ || FILENAME_CMP (output_filename, ALSO_NULL_DEVICE) == 0)
+ splitting = 0;
+ else
+ output_filename = insert_toplevel_subdirectory (output_filename);
real_output_filename = xstrdup (output_filename);
}
else if (!real_output_filename)
@@ -1538,7 +1561,7 @@ convert_from_loaded_file (name)
/* Make the displayable filename from output_filename. Only the base
portion of the filename need be displayed. */
- flush_output (); /* in case there was no @bye */
+ flush_output (); /* in case there was no @bye */
if (output_stream != stdout)
pretty_output_filename = filename_part (output_filename);
else
@@ -1604,7 +1627,7 @@ finished:
close_paragraph ();
}
- flush_output (); /* in case there was no @bye */
+ flush_output (); /* in case there was no @bye */
if (output_stream != stdout)
fclose (output_stream);
@@ -1614,7 +1637,7 @@ finished:
/* If we need to output the table of contents, do it now. */
if (contents_filename || shortcontents_filename)
- toc_update ();
+ toc_update ();
if (splitting && !html && (!errors_printed || force))
split_file (real_output_filename, split_size);
@@ -1708,7 +1731,7 @@ handle_menu_entry ()
if (had_menu_commentary)
{
- add_word ("<ul>\n");
+ add_word ("<ul class=\"menu\">\n");
had_menu_commentary = 0;
in_paragraph = 0;
}
@@ -1726,11 +1749,11 @@ handle_menu_entry ()
add_word ("<li><a");
if (next_menu_item_number <= 9)
- {
- add_word(" accesskey=");
- add_word_args("%d", next_menu_item_number);
- next_menu_item_number++;
- }
+ {
+ add_word(" accesskey=");
+ add_word_args("\"%d\"", next_menu_item_number);
+ next_menu_item_number++;
+ }
add_word (" href=\"");
string = expansion (tem, 0);
add_anchor_name (string, 1);
@@ -1753,7 +1776,7 @@ handle_menu_entry ()
get_until_in_line (0, ".", &string);
free (string);
}
- input_text_offset++; /* discard the second colon or the period */
+ input_text_offset++; /* discard the second colon or the period */
add_word (": ");
}
else if (xml && tem)
@@ -1820,7 +1843,9 @@ read_command ()
if (!(def->flags & ME_RECURSE))
def->inhibited = 1;
+ executing_macro++;
execute_macro (def);
+ executing_macro--;
if (!(def->flags & ME_RECURSE))
def->inhibited = 0;
@@ -1992,8 +2017,8 @@ reader_loop ()
case '<':
if (html && escape_html)
add_word ("&lt;");
- else if (xml)
- xml_insert_entity ("lt");
+ else if (xml && escape_html)
+ xml_insert_entity ("lt");
else
add_char (character);
input_text_offset++;
@@ -2002,8 +2027,8 @@ reader_loop ()
case '>':
if (html && escape_html)
add_word ("&gt;");
- else if (xml)
- xml_insert_entity ("gt");
+ else if (xml && escape_html)
+ xml_insert_entity ("gt");
else
add_char (character);
input_text_offset++;
@@ -2021,7 +2046,7 @@ reader_loop ()
we can ignore its partner. */
if (!only_macro_expansion)
{
- if (!STREQ (command, "math"))
+ if (command && !STREQ (command, "math"))
{
line_error (_("Misplaced %c"), '{');
remember_brace (misplaced_brace);
@@ -2166,8 +2191,8 @@ discard_braces ()
proc_name = find_proc_name (brace_stack->proc);
file_line_error (input_filename, brace_stack->line,
- _("%c%s missing close brace"), COMMAND_PREFIX,
- proc_name);
+ _("%c%s missing close brace"), COMMAND_PREFIX,
+ proc_name);
pop_and_call_brace ();
}
else
@@ -2297,7 +2322,10 @@ add_char (character)
{
if (html || docbook)
{ /* Seems cleaner to use &nbsp; than an 8-bit char. */
+ int saved_escape_html = escape_html;
+ escape_html = 0;
add_word ("&nbsp");
+ escape_html = saved_escape_html;
character = ';';
}
else
@@ -2309,7 +2337,7 @@ add_char (character)
switch (character)
{
case '\n':
- if (!filling_enabled && ! (html && (in_menu || in_detailmenu)))
+ if (!filling_enabled && !(html && (in_menu || in_detailmenu)))
{
insert ('\n');
@@ -2366,13 +2394,14 @@ add_char (character)
}
}
- /* This is sad, but it seems desirable to not force any
- particular order on the front matter commands. This way,
- the document can do @settitle, @documentlanguage, etc, in
- any order and with any omissions, and we'll still output
- the html <head> `just in time'. */
- if (!executing_string && html && !html_output_head_p)
- html_output_head ();
+ /* This is sad, but it seems desirable to not force any
+ particular order on the front matter commands. This way,
+ the document can do @settitle, @documentlanguage, etc, in
+ any order and with any omissions, and we'll still output
+ the html <head> `just in time'. */
+ if ((executing_macro || !executing_string)
+ && html && !html_output_head_p)
+ html_output_head ();
if (!paragraph_is_open)
{
@@ -2387,7 +2416,7 @@ add_char (character)
/* This horrible kludge of checking for a < prevents <p>
from being inserted when we already have html markup
starting a paragraph, as with <ul> and <h1> and the like. */
- if (html && escape_html && character != '<'
+ if ((html || xml) && escape_html && character != '<'
&& (!in_fixed_width_font || in_menu || in_detailmenu))
{
insert_string ("<p>");
@@ -2861,9 +2890,6 @@ void
indent (amount)
int amount;
{
- if (html)
- return;
-
/* For every START_POS saved within the brace stack which will be affected
by this indentation, bump that start pos forward. */
adjust_braces_following (output_paragraph_offset, amount);
@@ -2902,6 +2928,9 @@ get_xref_token (expand)
{
char *string;
+ if (docbook)
+ xml_in_xref_token = 1;
+
if (expand)
{
int old_offset = input_text_offset;
@@ -2927,6 +2956,10 @@ get_xref_token (expand)
if (curchar () == ',')
input_text_offset++;
fix_whitespace (string);
+
+ if (docbook)
+ xml_in_xref_token = 0;
+
return string;
}
@@ -2952,66 +2985,66 @@ cm_xref (arg)
char *tem;
/* "@xref{,Foo,, Bar, Baz} is not valid usage of @xref. The
- first argument must never be blank." --rms.
- We hereby comply by disallowing such constructs. */
+ first argument must never be blank." --rms.
+ We hereby comply by disallowing such constructs. */
if (!*arg1)
- line_error (_("First argument to cross-reference may not be empty"));
+ line_error (_("First argument to cross-reference may not be empty"));
if (xml && docbook)
- {
- if (!*arg4 && !*arg5)
- {
- char *arg1_id = xml_id (arg1);
- if (*arg2)
- {
- xml_insert_element_with_attribute (XREFNODENAME, START,
- "linkend=\"%s\"", arg1_id);
- free (arg1_id);
- if (*arg2)
- execute_string (arg2);
- xml_insert_element (XREFNODENAME, END);
- }
- else
- {
- xml_insert_element_with_attribute (XREF, START,
- "linkend=\"%s\"", arg1_id);
- free (arg1_id);
- xml_pop_current_element ();
- }
- }
- }
+ {
+ if (!*arg4 && !*arg5)
+ {
+ char *arg1_id = xml_id (arg1);
+ if (*arg2)
+ {
+ xml_insert_element_with_attribute (XREFNODENAME, START,
+ "linkend=\"%s\"", arg1_id);
+ free (arg1_id);
+ if (*arg2)
+ execute_string (arg2);
+ xml_insert_element (XREFNODENAME, END);
+ }
+ else
+ {
+ xml_insert_element_with_attribute (XREF, START,
+ "linkend=\"%s\"", arg1_id);
+ free (arg1_id);
+ xml_pop_current_element ();
+ }
+ }
+ }
else if (xml)
- {
- xml_insert_element (XREF, START);
- xml_insert_element (XREFNODENAME, START);
- execute_string (arg1);
- xml_insert_element (XREFNODENAME, END);
- if (*arg2)
- {
- xml_insert_element (XREFINFONAME, START);
- execute_string (arg2);
- xml_insert_element (XREFINFONAME, END);
- }
- if (*arg3)
- {
- xml_insert_element (XREFPRINTEDDESC, START);
- execute_string (arg3);
- xml_insert_element (XREFPRINTEDDESC, END);
- }
- if (*arg4)
- {
- xml_insert_element (XREFINFOFILE, START);
- execute_string (arg4);
- xml_insert_element (XREFINFOFILE, END);
- }
- if (*arg5)
- {
- xml_insert_element (XREFPRINTEDNAME, START);
- execute_string (arg5);
- xml_insert_element (XREFPRINTEDNAME, END);
- }
- xml_insert_element (XREF, END);
- }
+ {
+ xml_insert_element (XREF, START);
+ xml_insert_element (XREFNODENAME, START);
+ execute_string (arg1);
+ xml_insert_element (XREFNODENAME, END);
+ if (*arg2)
+ {
+ xml_insert_element (XREFINFONAME, START);
+ execute_string (arg2);
+ xml_insert_element (XREFINFONAME, END);
+ }
+ if (*arg3)
+ {
+ xml_insert_element (XREFPRINTEDDESC, START);
+ execute_string (arg3);
+ xml_insert_element (XREFPRINTEDDESC, END);
+ }
+ if (*arg4)
+ {
+ xml_insert_element (XREFINFOFILE, START);
+ execute_string (arg4);
+ xml_insert_element (XREFINFOFILE, END);
+ }
+ if (*arg5)
+ {
+ xml_insert_element (XREFPRINTEDNAME, START);
+ execute_string (arg5);
+ xml_insert_element (XREFPRINTEDNAME, END);
+ }
+ xml_insert_element (XREF, END);
+ }
else if (html)
{
if (!ref_flag)
@@ -3021,125 +3054,125 @@ cm_xref (arg)
add_word_args ("%s", px_ref_flag ? "*note " : "*Note ");
if (!xml)
- {
- if (*arg5 || *arg4)
- {
- /* arg1 - node name
- arg2 - reference name
- arg3 - title or topic (and reference name if arg2 is NULL)
- arg4 - info file name
- arg5 - printed manual title */
- char *ref_name;
-
- if (!*arg2)
- {
- if (*arg3)
- ref_name = arg3;
- else
- ref_name = arg1;
- }
- else
- ref_name = arg2;
-
- if (html)
- {
- /* html fixxme: revisit this; external node name not
- much use to us with numbered nodes. */
- add_html_elt ("<a href=");
- /* Note that if we are splitting, and the referenced
- tag is an anchor rather than a node, we will
- produce a reference to a file whose name is
- derived from the anchor name. However, only
- nodes create files, so we are referencing a
- non-existent file. cm_anchor, which see, deals
- with that problem. */
- if (splitting)
- execute_string ("\"../%s/", arg4);
- else
- execute_string ("\"%s.html", arg4);
- /* Do not collapse -- to -, etc., in references. */
- in_fixed_width_font++;
- tem = expansion (arg1, 0); /* expand @-commands in node */
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", ref_name);
- add_word ("</a>");
- }
- else
- {
- execute_string ("%s:", ref_name);
- in_fixed_width_font++;
- execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." : "");
- in_fixed_width_font--;
- }
-
- /* Free all of the arguments found. */
- if (arg1) free (arg1);
- if (arg2) free (arg2);
- if (arg3) free (arg3);
- if (arg4) free (arg4);
- if (arg5) free (arg5);
- return;
- }
- else
- remember_node_reference (arg1, line_number, followed_reference);
-
- if (*arg3)
- {
- if (html)
- {
- add_html_elt ("<a href=\"");
- in_fixed_width_font++;
- tem = expansion (arg1, 0);
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", *arg2 ? arg2 : arg3);
- add_word ("</a>");
- }
- else
- {
- execute_string ("%s:", *arg2 ? arg2 : arg3);
- in_fixed_width_font++;
- execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
- in_fixed_width_font--;
- }
- }
- else
- {
- if (html)
- {
- add_html_elt ("<a href=\"");
- in_fixed_width_font++;
- tem = expansion (arg1, 0);
- in_fixed_width_font--;
- add_anchor_name (tem, 1);
- free (tem);
- add_word ("\">");
- execute_string ("%s", *arg2 ? arg2 : arg1);
- add_word ("</a>");
- }
- else
- {
- if (*arg2)
- {
- execute_string ("%s:", arg2);
- in_fixed_width_font++;
- execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
- in_fixed_width_font--;
- }
- else
- {
- in_fixed_width_font++;
- execute_string ("%s::", arg1);
- in_fixed_width_font--;
- }
- }
- }
- }
+ {
+ if (*arg5 || *arg4)
+ {
+ /* arg1 - node name
+ arg2 - reference name
+ arg3 - title or topic (and reference name if arg2 is NULL)
+ arg4 - info file name
+ arg5 - printed manual title */
+ char *ref_name;
+
+ if (!*arg2)
+ {
+ if (*arg3)
+ ref_name = arg3;
+ else
+ ref_name = arg1;
+ }
+ else
+ ref_name = arg2;
+
+ if (html)
+ {
+ /* html fixxme: revisit this; external node name not
+ much use to us with numbered nodes. */
+ add_html_elt ("<a href=");
+ /* Note that if we are splitting, and the referenced
+ tag is an anchor rather than a node, we will
+ produce a reference to a file whose name is
+ derived from the anchor name. However, only
+ nodes create files, so we are referencing a
+ non-existent file. cm_anchor, which see, deals
+ with that problem. */
+ if (splitting)
+ execute_string ("\"../%s/", arg4);
+ else
+ execute_string ("\"%s.html", arg4);
+ /* Do not collapse -- to -, etc., in references. */
+ in_fixed_width_font++;
+ tem = expansion (arg1, 0); /* expand @-commands in node */
+ in_fixed_width_font--;
+ add_anchor_name (tem, 1);
+ free (tem);
+ add_word ("\">");
+ execute_string ("%s", ref_name);
+ add_word ("</a>");
+ }
+ else
+ {
+ execute_string ("%s:", ref_name);
+ in_fixed_width_font++;
+ execute_string (" (%s)%s%s", arg4, arg1, px_ref_flag ? "." : "");
+ in_fixed_width_font--;
+ }
+
+ /* Free all of the arguments found. */
+ if (arg1) free (arg1);
+ if (arg2) free (arg2);
+ if (arg3) free (arg3);
+ if (arg4) free (arg4);
+ if (arg5) free (arg5);
+ return;
+ }
+ else
+ remember_node_reference (arg1, line_number, followed_reference);
+
+ if (*arg3)
+ {
+ if (html)
+ {
+ add_html_elt ("<a href=\"");
+ in_fixed_width_font++;
+ tem = expansion (arg1, 0);
+ in_fixed_width_font--;
+ add_anchor_name (tem, 1);
+ free (tem);
+ add_word ("\">");
+ execute_string ("%s", *arg2 ? arg2 : arg3);
+ add_word ("</a>");
+ }
+ else
+ {
+ execute_string ("%s:", *arg2 ? arg2 : arg3);
+ in_fixed_width_font++;
+ execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
+ in_fixed_width_font--;
+ }
+ }
+ else
+ {
+ if (html)
+ {
+ add_html_elt ("<a href=\"");
+ in_fixed_width_font++;
+ tem = expansion (arg1, 0);
+ in_fixed_width_font--;
+ add_anchor_name (tem, 1);
+ free (tem);
+ add_word ("\">");
+ execute_string ("%s", *arg2 ? arg2 : arg1);
+ add_word ("</a>");
+ }
+ else
+ {
+ if (*arg2)
+ {
+ execute_string ("%s:", arg2);
+ in_fixed_width_font++;
+ execute_string (" %s%s", arg1, px_ref_flag ? "." : "");
+ in_fixed_width_font--;
+ }
+ else
+ {
+ in_fixed_width_font++;
+ execute_string ("%s::", arg1);
+ in_fixed_width_font--;
+ }
+ }
+ }
+ }
/* Free all of the arguments found. */
if (arg1) free (arg1);
if (arg2) free (arg2);
@@ -3209,43 +3242,43 @@ cm_inforef (arg)
/* (see comments at cm_xref). */
if (!*node)
- line_error (_("First argument to @inforef may not be empty"));
+ line_error (_("First argument to @inforef may not be empty"));
if (xml && !docbook)
- {
- xml_insert_element (INFOREF, START);
- xml_insert_element (INFOREFNODENAME, START);
- execute_string (node);
- xml_insert_element (INFOREFNODENAME, END);
- if (*pname)
- {
- xml_insert_element (INFOREFREFNAME, START);
- execute_string (pname);
- xml_insert_element (INFOREFREFNAME, END);
- }
- xml_insert_element (INFOREFINFONAME, START);
- execute_string (file);
- xml_insert_element (INFOREFINFONAME, END);
-
- xml_insert_element (INFOREF, END);
- }
+ {
+ xml_insert_element (INFOREF, START);
+ xml_insert_element (INFOREFNODENAME, START);
+ execute_string (node);
+ xml_insert_element (INFOREFNODENAME, END);
+ if (*pname)
+ {
+ xml_insert_element (INFOREFREFNAME, START);
+ execute_string (pname);
+ xml_insert_element (INFOREFREFNAME, END);
+ }
+ xml_insert_element (INFOREFINFONAME, START);
+ execute_string (file);
+ xml_insert_element (INFOREFINFONAME, END);
+
+ xml_insert_element (INFOREF, END);
+ }
else if (html)
{
- char *tem;
+ char *tem;
add_word (_("see "));
/* html fixxme: revisit this */
add_html_elt ("<a href=");
- if (splitting)
- execute_string ("\"../%s/", file);
- else
- execute_string ("\"%s.html", file);
- tem = expansion (node, 0);
- add_anchor_name (tem, 1);
+ if (splitting)
+ execute_string ("\"../%s/", file);
+ else
+ execute_string ("\"%s.html", file);
+ tem = expansion (node, 0);
+ add_anchor_name (tem, 1);
add_word ("\">");
execute_string ("%s", *pname ? pname : tem);
add_word ("</a>");
- free (tem);
+ free (tem);
}
else
{
@@ -3274,25 +3307,25 @@ cm_uref (arg)
char *replacement = get_xref_token (0);
if (xml)
- {
- xml_insert_element (UREF, START);
- xml_insert_element (UREFURL, START);
- execute_string (url);
- xml_insert_element (UREFURL, END);
- if (*desc)
- {
- xml_insert_element (UREFDESC, START);
- execute_string (desc);
- xml_insert_element (UREFDESC, END);
- }
- if (*replacement)
- {
- xml_insert_element (UREFREPLACEMENT, START);
- execute_string (replacement);
- xml_insert_element (UREFREPLACEMENT, END);
- }
- xml_insert_element (UREF, END);
- }
+ {
+ xml_insert_element (UREF, START);
+ xml_insert_element (UREFURL, START);
+ execute_string (url);
+ xml_insert_element (UREFURL, END);
+ if (*desc)
+ {
+ xml_insert_element (UREFDESC, START);
+ execute_string (desc);
+ xml_insert_element (UREFDESC, END);
+ }
+ if (*replacement)
+ {
+ xml_insert_element (UREFREPLACEMENT, START);
+ execute_string (replacement);
+ xml_insert_element (UREFREPLACEMENT, END);
+ }
+ xml_insert_element (UREF, END);
+ }
else if (html)
{ /* never need to show the url */
add_html_elt ("<a href=");
@@ -3343,26 +3376,26 @@ cm_email (arg)
char *name = get_xref_token (0);
if (xml && docbook)
- {
- xml_insert_element_with_attribute (EMAIL, START, "url=\"mailto:%s\"", addr);
- if (*name)
- execute_string (name);
- xml_insert_element (EMAIL, END);
- }
+ {
+ xml_insert_element_with_attribute (EMAIL, START, "url=\"mailto:%s\"", addr);
+ if (*name)
+ execute_string (name);
+ xml_insert_element (EMAIL, END);
+ }
else if (xml)
- {
- xml_insert_element (EMAIL, START);
- xml_insert_element (EMAILADDRESS, START);
- execute_string (addr);
- xml_insert_element (EMAILADDRESS, END);
- if (*name)
- {
- xml_insert_element (EMAILNAME, START);
- execute_string (name);
- xml_insert_element (EMAILNAME, END);
- }
- xml_insert_element (EMAIL, END);
- }
+ {
+ xml_insert_element (EMAIL, START);
+ xml_insert_element (EMAILADDRESS, START);
+ execute_string (addr);
+ xml_insert_element (EMAILADDRESS, END);
+ if (*name)
+ {
+ xml_insert_element (EMAILNAME, START);
+ execute_string (name);
+ xml_insert_element (EMAILNAME, END);
+ }
+ xml_insert_element (EMAIL, END);
+ }
else if (html)
{
add_html_elt ("<a href=");
@@ -3395,20 +3428,14 @@ void
cm_image (arg)
int arg;
{
- char *name_arg, *rest, *alt_arg, *ext_arg;
+ char *name_arg, *w_arg, *h_arg, *alt_arg, *ext_arg;
if (arg == END)
return;
name_arg = get_xref_token (1); /* expands all macros in image */
- /* We don't (yet) care about the next two args, but read them so they
- don't end up in the text. */
- rest = get_xref_token (0);
- if (rest)
- free (rest);
- rest = get_xref_token (0);
- if (rest)
- free (rest);
+ w_arg = get_xref_token (0);
+ h_arg = get_xref_token (0);
alt_arg = get_xref_token (1); /* expands all macros in alt text */
ext_arg = get_xref_token (0);
@@ -3419,18 +3446,18 @@ cm_image (arg)
if (html)
{
- if (ext_arg && *ext_arg)
- {
- sprintf (fullname, "%s.%s", name_arg, ext_arg);
- if (access (fullname, R_OK) != 0)
- {
+ if (ext_arg && *ext_arg)
+ {
+ sprintf (fullname, "%s.%s", name_arg, ext_arg);
+ if (access (fullname, R_OK) != 0)
+ {
line_error(_("@image file `%s' (for HTML) not readable: %s"),
- fullname, strerror (errno));
- return;
- }
- }
- else
- {
+ fullname, strerror (errno));
+ return;
+ }
+ }
+ else
+ {
sprintf (fullname, "%s.png", name_arg);
if (access (fullname, R_OK) != 0)
{
@@ -3442,21 +3469,21 @@ cm_image (arg)
return;
}
}
- }
+ }
- add_html_elt ("<img src=");
+ add_html_elt ("<img src=");
add_word_args ("\"%s\"", fullname);
- add_html_elt (" alt=");
- add_word_args ("\"%s\">", (*alt_arg) ? alt_arg : fullname);
+ add_html_elt (" alt=");
+ add_word_args ("\"%s\">", (*alt_arg) ? alt_arg : fullname);
}
else if (xml && docbook)
- xml_insert_docbook_image (name_arg);
+ xml_insert_docbook_image (name_arg);
else if (xml)
- {
- xml_insert_element (IMAGE, START);
- add_word (name_arg);
- xml_insert_element (IMAGE, END);
- }
+ {
+ xml_insert_element_with_attribute (IMAGE, START, "width=\"%s\" height=\"%s\" alttext=\"%s\" extension=\"%s\"", w_arg, h_arg, alt_arg, ext_arg);
+ add_word (name_arg);
+ xml_insert_element (IMAGE, END);
+ }
else
{ /* Try to open foo.txt. */
FILE *image_file;
@@ -3498,6 +3525,10 @@ cm_image (arg)
if (name_arg)
free (name_arg);
+ if (w_arg)
+ free (w_arg);
+ if (h_arg)
+ free (h_arg);
if (alt_arg)
free (alt_arg);
if (ext_arg)
@@ -3654,8 +3685,8 @@ cm_value (arg, start_pos, end_pos)
saved_meta_pos = meta_char_pos;
value_level++;
/* While the argument of @value is processed, we need to inhibit
- textual transformations like "--" into "-", since @set didn't
- do that when it grabbed the name of the variable. */
+ textual transformations like "--" into "-", since @set didn't
+ do that when it grabbed the name of the variable. */
in_fixed_width_font++;
}
else
@@ -3680,9 +3711,9 @@ cm_value (arg, start_pos, end_pos)
}
value_level--;
/* No need to decrement in_fixed_width_font, since before
- we are called with arg == END, the reader loop already
- popped the brace stack, which restored in_fixed_width_font,
- among other things. */
+ we are called with arg == END, the reader loop already
+ popped the brace stack, which restored in_fixed_width_font,
+ among other things. */
if (value)
execute_string ("%s", value);
@@ -3846,9 +3877,9 @@ handle_variable_internal (action, name)
}
if (!done)
- file_line_error (input_filename, orig_line_number,
- _("Reached eof before matching @end %s"),
- condition);
+ file_line_error (input_filename, orig_line_number,
+ _("Reached eof before matching @end %s"),
+ condition);
/* We found the end of a false @ifset/ifclear. If we are
in a menu, back up over the newline that ends the ifset,
@@ -4076,8 +4107,8 @@ full_expansion (str, implicit_code)
inhibit_output_flushing ();
paragraph_is_open = 1;
if (strlen (str) > (implicit_code
- ? EXECUTE_STRING_MAX - 1 - sizeof("@code{}")
- : EXECUTE_STRING_MAX - 1))
+ ? EXECUTE_STRING_MAX - 1 - sizeof("@code{}")
+ : EXECUTE_STRING_MAX - 1))
line_error (_("`%.40s...' is too long for expansion; not expanded"), str);
else
execute_string (implicit_code ? "@code{%s}" : "%s", str);
diff --git a/contrib/texinfo/makeinfo/makeinfo.h b/contrib/texinfo/makeinfo/makeinfo.h
index ad4ee57..bc322e2 100644
--- a/contrib/texinfo/makeinfo/makeinfo.h
+++ b/contrib/texinfo/makeinfo/makeinfo.h
@@ -1,7 +1,8 @@
/* makeinfo.h -- declarations for Makeinfo.
- $Id: makeinfo.h,v 1.37 2002/03/28 16:33:48 karl Exp $
+ $Id: makeinfo.h,v 1.3 2003/01/17 17:14:34 karl Exp $
- Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -194,6 +195,9 @@ DECLARE (int, process_plaintext, -1);
/* Nonzero means that we process @tex and @iftex. (--iftex) */
DECLARE (int, process_tex, 0);
+/* Nonzero means that we process @xml and @ifxml. (--ifxml) */
+DECLARE (int, process_xml, 0);
+
/* Maximum number of references to a single node before complaining.
(--reference-limit) */
DECLARE (int, reference_warning_limit, 1000);
@@ -261,11 +265,6 @@ DECLARE (int, expensive_validation, 0);
#define DEFAULT_SPLIT_SIZE 50000 /* Is probably good enough for me. */
DECLARE (int, splitting, 1); /* Defaults to true for now. */
-#define command_char(c) (!cr_or_whitespace(c) \
- && (c) != '{' \
- && (c) != '}' \
- && (c) != '=')
-
#define skip_whitespace() \
while ((input_text_offset != input_text_length) && \
whitespace (curchar())) \
diff --git a/contrib/texinfo/makeinfo/multi.c b/contrib/texinfo/makeinfo/multi.c
index 6b6ec3d..d5cc19c 100644
--- a/contrib/texinfo/makeinfo/multi.c
+++ b/contrib/texinfo/makeinfo/multi.c
@@ -1,7 +1,8 @@
-/* multi.c -- multitable stuff for makeinfo.
- $Id: multi.c,v 1.23 2002/01/19 01:09:08 karl Exp $
+/* multi.c -- multiple-column tables (@multitable) for makeinfo.
+ $Id: multi.c,v 1.4 2002/11/04 21:28:10 karl Exp $
- Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -423,8 +424,9 @@ multitable_item ()
/* start at column 1 */
select_output_environment (1);
if (!output_paragraph) {
- line_error (_("Cannot select column #%d in multitable"), current_env_no);
- exit (1);
+ line_error (_("[unexpected] cannot select column #%d in multitable"),
+ current_env_no);
+ xexit (1);
}
init_column ();
diff --git a/contrib/texinfo/makeinfo/node.c b/contrib/texinfo/makeinfo/node.c
index b5a90066..10f4c3a 100644
--- a/contrib/texinfo/makeinfo/node.c
+++ b/contrib/texinfo/makeinfo/node.c
@@ -1,7 +1,8 @@
/* node.c -- nodes for Texinfo.
- $Id: node.c,v 1.34 2002/03/26 16:16:29 karl Exp $
+ $Id: node.c,v 1.6 2003/01/18 17:16:17 karl Exp $
- Copyright (C) 1998, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -306,7 +307,12 @@ remember_node (node, prev, next, up, position, line_no, fname, flags)
node_number++;
new->number = node_number;
}
- new->html_fname = fname;
+ if (fname)
+ new->html_fname = fname;
+ else
+ /* This happens for Top node under split-HTML, for example. */
+ new->html_fname
+ = normalize_filename (filename_part (current_output_filename));
new->next_ent = tag_table;
tag_table = new;
}
@@ -478,7 +484,7 @@ set_current_output_filename (fname)
/* The order is: nodename, nextnode, prevnode, upnode.
If all of the NEXT, PREV, and UP fields are empty, they are defaulted.
You must follow a node command which has those fields defaulted
- with a sectioning command (e.g. @chapter) giving the "level" of that node.
+ with a sectioning command (e.g., @chapter) giving the "level" of that node.
It is an error not to do so.
The defaults come from the menu in this node's parent. */
void
@@ -652,7 +658,7 @@ cm_node ()
}
line_error
- (_("Node `%s' requires a sectioning command (e.g. %c%s)"),
+ (_("Node `%s' requires a sectioning command (e.g., %c%s)"),
node, COMMAND_PREFIX, polite_section_name);
}
else
@@ -914,8 +920,9 @@ cm_node ()
}
if (splitting || !no_headers)
- { /* Navigation bar. The <p> avoids the links area running
- on with old Lynxen. */
+ { /* Navigation bar. */
+ add_word ("<div class=\"node\">\n");
+ /* The <p> avoids the links area running on with old Lynxen. */
add_word_args ("<p>%s\n", splitting ? "" : "<hr>");
add_word_args ("%s<a name=\"", _("Node:"));
tem = expand_node_name (node);
@@ -928,7 +935,7 @@ cm_node ()
tem = expansion (next, 0);
add_word (",\n");
add_word (_("Next:"));
- add_word ("<a rel=next accesskey=n href=\"");
+ add_word ("<a rel=\"next\" accesskey=\"n\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
free (tem);
@@ -938,7 +945,7 @@ cm_node ()
tem = expansion (prev, 0);
add_word (",\n");
add_word (_("Previous:"));
- add_word ("<a rel=previous accesskey=p href=\"");
+ add_word ("<a rel=\"previous\" accesskey=\"p\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
free (tem);
@@ -948,7 +955,7 @@ cm_node ()
tem = expansion (up, 0);
add_word (",\n");
add_word (_("Up:"));
- add_word ("<a rel=up accesskey=u href=\"");
+ add_word ("<a rel=\"up\" accesskey=\"u\" href=\"");
add_anchor_name (tem, 1);
add_word_args ("\">%s</a>", tem);
free (tem);
@@ -956,6 +963,7 @@ cm_node ()
/* html fixxme: we want a `top' or `contents' link here. */
add_word_args ("\n%s<br>\n", splitting ? "<hr>" : "");
+ add_word ("</div>\n");
}
}
else if (docbook)
@@ -1274,7 +1282,7 @@ validate (tag, line, label)
if (!result)
{
line_number = line;
- line_error (_("%s reference to nonexistent node `%s'"), label, tag);
+ line_error (_("%s reference to nonexistent node `%s' (perhaps incorrect sectioning?)"), label, tag);
return 0;
}
result->touched++;
@@ -1377,7 +1385,7 @@ validate_file (tag_table)
}
if (you_lose)
{
- line_error (_("Next field of node `%s' not pointed to"),
+ line_error (_("Next field of node `%s' not pointed to (perhaps incorrect sectioning?)"),
tags->node);
file_line_error (temp_tag->filename, temp_tag->line_no,
_("This node (%s) has the bad Prev"),
@@ -1451,7 +1459,7 @@ validate_file (tag_table)
if (!tags->up
&& !(tags->flags & TAG_FLAG_ANCHOR)
&& strcasecmp (tags->node, "Top") != 0)
- line_error (_("`%s' has no Up field"), tags->node);
+ line_error (_("`%s' has no Up field (perhaps incorrect sectioning?)"), tags->node);
else if (tags->up)
{
int valid_p = validate (tags->up, tags->line_no, _("Up"));
diff --git a/contrib/texinfo/makeinfo/node.h b/contrib/texinfo/makeinfo/node.h
index 735a231..a625e88 100644
--- a/contrib/texinfo/makeinfo/node.h
+++ b/contrib/texinfo/makeinfo/node.h
@@ -1,7 +1,7 @@
/* node.h -- declarations for Node.
- $Id: node.h,v 1.6 2002/01/16 15:52:45 karl Exp $
+ $Id: node.h,v 1.1 2002/08/25 23:38:39 karl Exp $
- Copyright (C) 1996, 97, 98, 99, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/contrib/texinfo/makeinfo/sectioning.c b/contrib/texinfo/makeinfo/sectioning.c
index 850fc46..761dd39 100644
--- a/contrib/texinfo/makeinfo/sectioning.c
+++ b/contrib/texinfo/makeinfo/sectioning.c
@@ -1,7 +1,7 @@
-/* sectioning.c -- all related stuff @chapter, @section... @contents
- $Id: sectioning.c,v 1.17 2002/02/09 00:54:51 karl Exp $
+/* sectioning.c -- for @chapter, @section, ..., @contents ...
+ $Id: sectioning.c,v 1.6 2002/11/08 02:21:07 karl Exp $
- Copyright (C) 1999, 2001, 02 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Karl Heinz Marbaise <kama@hippo.fido.de>. */
+ Originally written by Karl Heinz Marbaise <kama@hippo.fido.de>. */
#include "system.h"
#include "cmds.h"
@@ -103,10 +103,10 @@ get_sectioning_number (level, num)
{
p = s + strlen (s);
if ((i == 0) && (enum_marker == APPENDIX_MAGIC))
- sprintf (p, "%c.", numbers[i] + 64); /* Should be changed to
+ sprintf (p, "%c.", numbers[i] + 64); /* Should be changed to
be more portable */
else
- sprintf (p, "%d.", numbers[i]);
+ sprintf (p, "%d.", numbers[i]);
}
/* the last number is never followed by a dot */
@@ -203,7 +203,7 @@ what_section (text)
{
return_val = section_alist[index].level + section_alist_offset;
if (return_val < 0)
- return_val = 0;
+ return_val = 0;
else if (return_val > 5)
return_val = 5;
return return_val;
@@ -227,8 +227,8 @@ sectioning_underscore (cmd)
free (temp);
xml_close_sections (level);
/* Mark the beginning of the section
- If the next command is printindex, we will remove
- the section and put an Index instead */
+ If the next command is printindex, we will remove
+ the section and put an Index instead */
flush_output ();
xml_last_section_output_position = output_paragraph_offset;
@@ -262,7 +262,7 @@ sectioning_underscore (cmd)
{
character = scoring_characters[level];
insert_and_underscore (level, character, cmd);
- }
+ }
}
}
@@ -279,44 +279,44 @@ handle_enum_increment (level, index)
if (number_sections && section_alist[index].num == ENUM_SECT_NO)
{
if (level == 0
- && enum_marker != UNNUMBERED_MAGIC)
- enum_marker = UNNUMBERED_MAGIC;
+ && enum_marker != UNNUMBERED_MAGIC)
+ enum_marker = UNNUMBERED_MAGIC;
}
/* enumerate only things which are allowed */
if (number_sections && section_alist[index].num)
{
/* reset the marker if we get into enumerated areas */
if (section_alist[index].num == ENUM_SECT_YES
- && level == 0
- && enum_marker == UNNUMBERED_MAGIC)
- enum_marker = 0;
+ && level == 0
+ && enum_marker == UNNUMBERED_MAGIC)
+ enum_marker = 0;
/* This is special for appendix; if we got the first
time an appendix command then we are entering appendix.
Thats the point we have to start countint with A, B and so on. */
if (section_alist[index].num == ENUM_SECT_APP
- && level == 0
- && enum_marker != APPENDIX_MAGIC)
- {
- enum_marker = APPENDIX_MAGIC;
- numbers [0] = 0; /* this means we start with Appendix A */
- }
+ && level == 0
+ && enum_marker != APPENDIX_MAGIC)
+ {
+ enum_marker = APPENDIX_MAGIC;
+ numbers [0] = 0; /* this means we start with Appendix A */
+ }
/* only increment counters if we are not in unnumbered
area. This handles situations like this:
@unnumbered .... This sets enum_marker to UNNUMBERED_MAGIC
@section .... */
if (enum_marker != UNNUMBERED_MAGIC)
- {
- int i;
+ {
+ int i;
- /* reset all counters which are one level deeper */
- for (i = level; i < 3; i++)
- numbers [i + 1] = 0;
+ /* reset all counters which are one level deeper */
+ for (i = level; i < 3; i++)
+ numbers [i + 1] = 0;
- numbers[level]++;
- return xstrdup
- (get_sectioning_number (level, section_alist[index].num));
- }
+ numbers[level]++;
+ return xstrdup
+ (get_sectioning_number (level, section_alist[index].num));
+ }
} /* if (number_sections)... */
return xstrdup ("");
@@ -413,7 +413,8 @@ sectioning_html (level, cmd)
old_no_indent = no_indent;
no_indent = 1;
- add_word_args ("<h%d>", level + 2); /* level 0 (chapter) is <h2> */
+ /* level 0 (chapter) is <h2> */
+ add_word_args ("<h%d class=\"%s\">", level + 2, cmd);
/* If we are outside of any node, produce an anchor that
the TOC could refer to. */
@@ -426,8 +427,11 @@ sectioning_html (level, cmd)
toc_anchor = substring (starting_pos + sizeof (a_name) - 1,
output_paragraph + output_paragraph_offset);
/* This must be added after toc_anchor is extracted, since
- toc_anchor cannot include the closing </a>. For details,
- see toc.c:toc_add_entry and toc.c:contents_update_html. */
+ toc_anchor cannot include the closing </a>. For details,
+ see toc.c:toc_add_entry and toc.c:contents_update_html.
+
+ Also, the anchor close must be output before the section name
+ in case the name itself contains an anchor. */
add_word ("</a>");
}
starting_pos = output_paragraph + output_paragraph_offset;
@@ -523,7 +527,7 @@ cm_top ()
if (tag->flags & TAG_FLAG_IS_TOP)
{
file_line_error (tag->filename, tag->line_no,
- _("Here is the %ctop node"), COMMAND_PREFIX);
+ _("Here is the %ctop node"), COMMAND_PREFIX);
return;
}
tag = tag->next_ent;
diff --git a/contrib/texinfo/makeinfo/sectioning.h b/contrib/texinfo/makeinfo/sectioning.h
index 75243f0..455fc32 100644
--- a/contrib/texinfo/makeinfo/sectioning.h
+++ b/contrib/texinfo/makeinfo/sectioning.h
@@ -1,5 +1,5 @@
/* sectioning.h -- all related stuff @chapter, @section... @contents
- $Id: sectioning.h,v 1.2 1999/03/09 22:48:15 karl Exp $
+ $Id: sectioning.h,v 1.1 2002/08/25 23:38:39 karl Exp $
Copyright (C) 1999 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/texinfo.dtd b/contrib/texinfo/makeinfo/texinfo.dtd
index 8345b48..bdd34c9 100644
--- a/contrib/texinfo/makeinfo/texinfo.dtd
+++ b/contrib/texinfo/makeinfo/texinfo.dtd
@@ -1,4 +1,4 @@
-<!-- $Id: texinfo.dtd,v 1.5 2002/03/23 20:41:32 karl Exp $
+<!-- $Id: texinfo.dtd,v 1.2 2002/12/17 16:34:22 karl Exp $
Document Type Definition for Texinfo.
Author: Philippe Martin (feloy@free.fr)
@@ -98,7 +98,7 @@
<!-- NODES -->
<!-- ***** -->
<!ELEMENT node (nodename, nodenext?, nodeprev?, nodeup?,
- (para | menu | %section.all;)*) >
+ (%section.all; | %block;)*) >
<!ELEMENT nodename (#PCDATA)>
<!ELEMENT nodenext (#PCDATA)>
@@ -227,7 +227,7 @@
<!ELEMENT indexterm (#PCDATA | %Inline.phrase;)*>
<!ATTLIST indexterm
- INDEX CDATA #IMPLIED>
+ index CDATA #IMPLIED>
<!ELEMENT email (emailaddress, emailname?)>
<!ELEMENT emailaddress (#PCDATA | %Inline.phrase;)*>
diff --git a/contrib/texinfo/makeinfo/texinfo.xsl b/contrib/texinfo/makeinfo/texinfo.xsl
index 1740c12..efe36e9 100644
--- a/contrib/texinfo/makeinfo/texinfo.xsl
+++ b/contrib/texinfo/makeinfo/texinfo.xsl
@@ -1,5 +1,5 @@
<?xml version='1.0'?>
-<!-- $Id: texinfo.xsl,v 1.2 2002/04/01 14:06:15 karl Exp $ -->
+<!-- $Id: texinfo.xsl,v 1.1 2002/08/25 23:38:39 karl Exp $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
diff --git a/contrib/texinfo/makeinfo/toc.c b/contrib/texinfo/makeinfo/toc.c
index a9c8986..394a480 100644
--- a/contrib/texinfo/makeinfo/toc.c
+++ b/contrib/texinfo/makeinfo/toc.c
@@ -1,7 +1,7 @@
/* toc.c -- table of contents handling.
- $Id: toc.c,v 1.22 2002/04/01 14:07:11 karl Exp $
+ $Id: toc.c,v 1.3 2002/11/07 16:13:59 karl Exp $
- Copyright (C) 1999, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Karl Heinz Marbaise <kama@hippo.fido.de>. */
+ Originally written by Karl Heinz Marbaise <kama@hippo.fido.de>. */
#include "system.h"
#include "makeinfo.h"
@@ -218,7 +218,7 @@ contents_update_html (fp)
flush_output (); /* in case we are writing stdout */
- fprintf (fp, "\n<h2>%s</h2>\n<ul>\n", _("Table of Contents"));
+ fprintf (fp, "\n<div class=\"contents\">\n<h2>%s</h2>\n<ul>\n", _("Table of Contents"));
last_level = toc_entry_alist[0]->level;
@@ -237,7 +237,7 @@ contents_update_html (fp)
/* @subsubsection ...
@chapter ... this IS usual.*/
for (k = 0; k < (last_level-toc_entry_alist[i]->level); k++)
- fputs ("</ul>\n", fp);
+ fputs ("</li></ul>\n", fp);
}
/* No double entries in TOC. */
@@ -247,6 +247,9 @@ contents_update_html (fp)
/* each toc entry is a list item. */
fputs ("<li>", fp);
+ /* Insert link -- to an external file if splitting, or
+ within the current document if not splitting. */
+ fprintf (fp, "<a ");
/* For chapters (only), insert an anchor that the short contents
will link to. */
if (toc_entry_alist[i]->level == 0)
@@ -259,13 +262,10 @@ contents_update_html (fp)
ends, and use that in toc_FOO. */
while (*p && *p != '"')
p++;
- fprintf (fp, "<a name=\"toc_%.*s\"></a>\n ",
+ fprintf (fp, "name=\"toc_%.*s\" ",
p - toc_entry_alist[i]->name, toc_entry_alist[i]->name);
}
-
- /* Insert link -- to an external file if splitting, or
- within the current document if not splitting. */
- fprintf (fp, "<a href=\"%s#%s</a>\n",
+ fprintf (fp, "href=\"%s#%s</a>\n",
splitting ? toc_entry_alist[i]->html_file : "",
toc_entry_alist[i]->name);
}
@@ -276,9 +276,9 @@ contents_update_html (fp)
/* Go back to start level. */
if (toc_entry_alist[0]->level < last_level)
for (k = 0; k < (last_level-toc_entry_alist[0]->level); k++)
- fputs ("</ul>\n", fp);
+ fputs ("</li></ul>\n", fp);
- fputs ("</ul>\n\n", fp);
+ fputs ("</li></ul>\n</div>\n\n", fp);
}
/* print table of contents in ASCII (--no-headers)
@@ -327,7 +327,7 @@ shortcontents_update_html (fp)
flush_output (); /* in case we are writing stdout */
- fprintf (fp, "\n<h2>%s</h2>\n<ul>\n", _("Short Contents"));
+ fprintf (fp, "\n<div class=\"shortcontents\">\n<h2>%s</h2>\n<ul>\n", _("Short Contents"));
if (contents_filename)
toc_file = filename_part (contents_filename);
@@ -339,14 +339,14 @@ shortcontents_update_html (fp)
if (toc_entry_alist[i]->level == 0)
{
if (contents_filename)
- fprintf (fp, "<li><a href=\"%s#toc_%s</a>\n",
+ fprintf (fp, "<li><a href=\"%s#toc_%s</a></li>\n",
splitting ? toc_file : "", name);
else
fprintf (fp, "<a href=\"%s#%s</a>\n",
splitting ? toc_entry_alist[i]->html_file : "", name);
}
}
- fputs ("</ul>\n\n", fp);
+ fputs ("</ul>\n</div>\n\n", fp);
if (contents_filename)
free (toc_file);
}
diff --git a/contrib/texinfo/makeinfo/toc.h b/contrib/texinfo/makeinfo/toc.h
index 654a768..0d3e417 100644
--- a/contrib/texinfo/makeinfo/toc.h
+++ b/contrib/texinfo/makeinfo/toc.h
@@ -1,5 +1,5 @@
/* toc.h -- table of contents handling.
- $Id: toc.h,v 1.5 2002/02/09 00:54:51 karl Exp $
+ $Id: toc.h,v 1.1 2002/08/25 23:38:39 karl Exp $
Copyright (C) 1999 Free Software Foundation, Inc.
diff --git a/contrib/texinfo/makeinfo/xml.c b/contrib/texinfo/makeinfo/xml.c
index a7c20ae..16316e0 100644
--- a/contrib/texinfo/makeinfo/xml.c
+++ b/contrib/texinfo/makeinfo/xml.c
@@ -1,7 +1,7 @@
/* xml.c -- xml output.
- $Id: xml.c,v 1.11 2002/03/23 20:41:12 karl Exp $
+ $Id: xml.c,v 1.18 2002/12/17 16:34:22 karl Exp $
- Copyright (C) 2001, 02 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Written by Philippe Martin <feloy@free.fr>. */
+ Originally written by Philippe Martin <feloy@free.fr>. */
#include "system.h"
#include "makeinfo.h"
@@ -93,7 +93,7 @@ element texinfoml_element_list [] = {
{ "emph", 0, 1 },
{ "strong", 0, 1 },
{ "cite", 0, 1 },
- { "notfixedwidth", 0, 1 },
+ { "notfixedwidth", 0, 1 },
{ "i", 0, 1 },
{ "b", 0, 1 },
{ "r", 0, 1 },
@@ -103,17 +103,17 @@ element texinfoml_element_list [] = {
{ "sp", 0, 0 },
{ "center", 1, 0 },
{ "dircategory", 0, 0 },
- { "quotation", 1, 0 },
- { "example", 1, 0 },
- { "smallexample", 1, 0 },
- { "lisp", 1, 0 },
- { "smalllisp", 1, 0 },
+ { "quotation", 0, 0 },
+ { "example", 0, 0 },
+ { "smallexample", 0, 0 },
+ { "lisp", 0, 0 },
+ { "smalllisp", 0, 0 },
{ "cartouche", 1, 0 },
{ "copying", 1, 0 },
- { "format", 1, 0 },
- { "smallformat", 1, 0 },
- { "display", 1, 0 },
- { "smalldisplay", 1, 0 },
+ { "format", 0, 0 },
+ { "smallformat", 0, 0 },
+ { "display", 0, 0 },
+ { "smalldisplay", 0, 0 },
{ "footnote", 0, 1 },
{ "itemize", 0, 0 },
@@ -148,7 +148,7 @@ element texinfoml_element_list [] = {
{ "emailname", 0, 1 },
{ "group", 0, 0 },
-
+
{ "printindex", 0, 0 },
{ "anchor", 0, 1 },
{ "image", 0, 1 },
@@ -165,13 +165,18 @@ element texinfoml_element_list [] = {
{ "", 0, 0 }, /* INDEXDIV (docbook) */
{ "multitable", 0, 0 },
{ "", 0, 0 }, /* TGROUP (docbook) */
- { "columnfraction", 0, 0 },
+ { "columnfraction", 0, 0 },
{ "", 0, 0 }, /* TBODY (docbook) */
{ "entry", 0, 0 }, /* ENTRY (docbook) */
{ "row", 0, 0 }, /* ROW (docbook) */
{ "", 0, 0 }, /* BOOKINFO (docbook) */
{ "", 0, 0 }, /* ABSTRACT (docbook) */
{ "", 0, 0 }, /* REPLACEABLE (docbook) */
+ { "", 0, 0 }, /* ENVAR (docbook) */
+ { "", 0, 0 }, /* COMMENT (docbook) */
+ { "", 0, 0 }, /* FUNCTION (docbook) */
+ { "", 0, 0 }, /* LEGALNOTICE (docbook) */
+
{ "para", 0, 0 } /* Must be last */
/* name / contains para / contained in para */
};
@@ -207,7 +212,7 @@ element docbook_element_list [] = {
{ "chapter", 1, 0 }, /* CHAPHEADING */
{ "sect1", 1, 0 }, /* HEADING */
{ "sect2", 1, 0 }, /* SUBHEADING */
- { "sect3", 1, 0 }, /* SUBSUBHEADING */
+ { "simplesect", 1, 0 }, /* SUBSUBHEADING */
{ "", 1, 0 }, /* MENU */
{ "", 1, 0 }, /* MENUENTRY */
@@ -253,13 +258,13 @@ element docbook_element_list [] = {
{ "itemizedlist", 0, 0 }, /* ITEMIZE */
{ "", 0, 0 }, /* ITEMFUNCTION */
- { "listitem", 1, 0 },
+ { "listitem", 1, 0 }, /* ITEM */
{ "orderedlist", 0, 0 }, /* ENUMERATE */
{ "variablelist", 0, 0 }, /* TABLE */
{ "varlistentry", 0, 0 }, /* TABLEITEM */
{ "term", 0, 0 }, /* TABLETERM */
- { "indexterm", 0, 1 },
+ { "indexterm", 0, 1 }, /* INDEXTERM */
{ "xref", 0, 1 }, /* XREF */
{ "link", 0, 1 }, /* XREFNODENAME */
@@ -283,8 +288,8 @@ element docbook_element_list [] = {
{ "", 0, 1 }, /* EMAILNAME */
{ "", 0, 0 }, /* GROUP */
-
- { "index", 0, 0 }, /* PRINTINDEX */
+
+ { "index", 0, 1 }, /* PRINTINDEX */
{ "", 0, 1 }, /* ANCHOR */
{ "", 0, 1 }, /* IMAGE */
{ "primary", 0, 1 }, /* PRIMARY */
@@ -307,7 +312,11 @@ element docbook_element_list [] = {
{ "bookinfo", 0, 0 },
{ "abstract", 1, 0 },
{ "replaceable", 0, 0 },
-
+ { "envar", 0, 1 },
+ { "comment", 0, 0 },
+ { "function", 0, 1 },
+ { "legalnotice", 1, 0 },
+
{ "para", 0, 0 } /* Must be last */
/* name / contains para / contained in para */
};
@@ -324,8 +333,8 @@ typedef struct _replace_element
/* Elements to replace - Docbook only
-------------------
- if `element_to_replace' have to be inserted
- as a child of `element_containing,'
+ if `element_to_replace' have to be inserted
+ as a child of `element_containing,'
use `element_replacing' instead.
A value of `-1' for element_replacing means `do not use any element.'
@@ -339,6 +348,12 @@ replace_element replace_elements [] = {
{ CODE, DFN, -1 },
{ CODE, VAR, -1 },
{ EMPH, CODE, REPLACEABLE },
+ { VAR, VAR, -1},
+ { VAR, B, EMPH},
+ { B, CODE, ENVAR},
+ { CODE, I, EMPH},
+ { FORMAT, BOOKINFO, ABSTRACT },
+ { QUOTATION, ABSTRACT, -1},
/* Add your elements to replace here */
{-1, 0, 0}
};
@@ -354,14 +369,27 @@ int xml_no_para = 0;
char *xml_node_id = NULL;
int xml_sort_index = 0;
+int xml_in_xref_token = 0;
+int xml_in_bookinfo = 0;
+int xml_in_book_title = 0;
+int xml_in_abstract = 0;
+
static int xml_after_table_term = 0;
static int book_started = 0;
static int first_section_opened = 0;
-static int in_abstract = 0;
+
+static int xml_in_item[256];
+static int xml_table_level = 0;
+
+static int in_table_title = 0;
+
+static int in_indexentry = 0;
+static int in_secondary = 0;
+static int in_indexterm = 0;
static int xml_current_element ();
-void
+void
#if defined (VA_FPRINTF) && __STDC__
xml_insert_element_with_attribute (int elt, int arg, char *format, ...);
#else
@@ -375,13 +403,14 @@ xml_id (id)
char *tem = xmalloc (strlen (id) + 1);
char *p = tem;
strcpy (tem, id);
- while (*p++)
+ while (*p)
{
- if (*p == ' ' || *p == '&' || *p == '/' || *p == '+')
- *p = '-';
+ if (strchr ("~ &/+^;?()%<>\"'$¿", *p))
+ *p = '-';
+ p++;
}
p = tem;
- while (*p == '-')
+ if (*p == '-')
*p = 'i';
return tem;
}
@@ -394,7 +423,7 @@ xml_element (name)
for (i=0; i<=PARA; i++)
{
if (strcasecmp (name, texinfoml_element_list[i].name) == 0)
- return i;
+ return i;
}
printf ("Error xml_element\n");
return -1;
@@ -421,7 +450,7 @@ xml_begin_document (output_filename)
if (docbook)
{
if (language_code != last_language_code)
- xml_insert_element_with_attribute (TEXINFO, START, "lang=\"%s\"", language_table[language_code].abbrev);
+ xml_insert_element_with_attribute (TEXINFO, START, "lang=\"%s\"", language_table[language_code].abbrev);
}
else
xml_insert_element (TEXINFO, START);
@@ -437,15 +466,15 @@ xml_begin_document (output_filename)
static int element_stack[256];
static int element_stack_index = 0;
-static void
+static void
xml_push_current_element (elt)
int elt;
{
element_stack[element_stack_index++] = elt;
if (element_stack_index > 200)
- printf ("*** stack overflow (%d - %s) ***\n",
- element_stack_index,
- xml_element_list[elt].name);
+ printf ("*** stack overflow (%d - %s) ***\n",
+ element_stack_index,
+ xml_element_list[elt].name);
}
void
@@ -453,9 +482,9 @@ xml_pop_current_element ()
{
element_stack_index--;
if (element_stack_index < 0)
- printf ("*** stack underflow (%d - %d) ***\n",
- element_stack_index,
- xml_current_element());
+ printf ("*** stack underflow (%d - %d) ***\n",
+ element_stack_index,
+ xml_current_element());
}
static int
@@ -487,12 +516,15 @@ xml_end_document ()
if (xml_node_open)
{
if (xml_node_level != -1)
- {
- xml_close_sections (xml_node_level);
- xml_node_level = -1;
- }
+ {
+ xml_close_sections (xml_node_level);
+ xml_node_level = -1;
+ }
xml_insert_element (NODE, END);
}
+ else
+ xml_close_sections (xml_node_level);
+
xml_insert_element (TEXINFO, END);
insert_string ("\n");
insert_string ("<!-- Keep this comment at the end of the file\n\
@@ -513,7 +545,7 @@ static int start_element_inserted = 1;
the next function, since otherwise the Solaris SUNWspro compiler
barfs because `element' is a typedef declared near the beginning of
this file. */
-void
+void
#if defined (VA_FPRINTF) && __STDC__
xml_insert_element_with_attribute (int elt, int arg, char *format, ...)
#else
@@ -526,39 +558,39 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
{
/* Look at the replace_elements table to see if we have to change the element */
if (xml_sort_index)
- return;
+ return;
if (docbook)
{
replace_element *element_list = replace_elements;
while (element_list->element_to_replace >= 0)
- {
- if ( ( (arg == START) &&
- (element_list->element_containing == xml_current_element ()) &&
- (element_list->element_to_replace == elt) ) ||
- ( (arg == END) &&
- (element_list->element_containing == element_stack[element_stack_index-1-start_element_inserted]) &&
- (element_list->element_to_replace == elt) ) )
- {
- elt = element_list->element_replacing;
- break;
- }
- element_list ++;
- }
-
+ {
+ if ( ( (arg == START) &&
+ (element_list->element_containing == xml_current_element ()) &&
+ (element_list->element_to_replace == elt) ) ||
+ ( (arg == END) &&
+ (element_list->element_containing == element_stack[element_stack_index-1-start_element_inserted]) &&
+ (element_list->element_to_replace == elt) ) )
+ {
+ elt = element_list->element_replacing;
+ break;
+ }
+ element_list ++;
+ }
+
/* Forget the element */
if (elt < 0)
- {
- if (arg == START)
- start_element_inserted = 0;
- else
- /* Replace the default value, for the next time */
- start_element_inserted = 1;
- return;
- }
+ {
+ if (arg == START)
+ start_element_inserted = 0;
+ else
+ /* Replace the default value, for the next time */
+ start_element_inserted = 1;
+ return;
+ }
}
if (!book_started)
- return;
+ return;
if (xml_after_table_term && elt != TABLETERM)
{
@@ -568,15 +600,15 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
if (docbook && !only_macro_expansion && (in_menu || in_detailmenu))
return;
-
+
if (!xml_element_list[elt].name || !strlen (xml_element_list[elt].name))
{
- /* printf ("Warning: Inserting empty element %d\n", elt);*/
+ /*printf ("Warning: Inserting empty element %d\n", elt);*/
return;
}
if (arg == START && !xml_in_para && !xml_no_para
- && xml_element_list[elt].contained_in_para
+ && xml_element_list[elt].contained_in_para
&& xml_element_list[xml_current_element()].contains_para )
{
xml_indent ();
@@ -591,7 +623,7 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
insert_string ("</para>");
xml_in_para = 0;
}
-
+
if (arg == END && xml_in_para && !xml_element_list[elt].contained_in_para)
{
xml_indent_end_para ();
@@ -602,6 +634,15 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
if (arg == START && !xml_in_para && !xml_element_list[elt].contained_in_para)
xml_indent ();
+ if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
+ && arg == START && elt != TABLEITEM && elt != TABLETERM
+ && !in_indexterm && xml_current_element() == TABLE)
+ {
+ in_table_title = 1;
+ xml_insert_element (TITLE, START);
+ }
+
+
if (arg == START)
xml_push_current_element (elt);
else
@@ -611,7 +652,7 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
if (arg == END)
insert ('/');
insert_string (xml_element_list[elt].name);
-
+
/* printf ("%s ", xml_element_list[elt].name);*/
if (format)
@@ -626,7 +667,7 @@ xml_insert_element_with_attribute (elt, arg, format, va_alist)
VA_SPRINTF (temp_string, format, ap);
#else
sprintf (temp_string, format, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
+#endif
insert (' ');
insert_string (temp_string);
va_end (ap);
@@ -664,8 +705,9 @@ xml_insert_entity (char *entity_name)
if (docbook && !only_macro_expansion && (in_menu || in_detailmenu))
return;
- if (!xml_in_para && !xml_no_para && !only_macro_expansion
- && xml_element_list[xml_current_element ()].contains_para)
+ if (!xml_in_para && !xml_no_para && !only_macro_expansion
+ && xml_element_list[xml_current_element ()].contains_para
+ && !in_fixed_width_font)
{
insert_string ("<para>");
xml_in_para = 1;
@@ -689,13 +731,24 @@ xml_section *last_section = NULL;
void
xml_begin_node ()
{
+ first_section_opened = 1;
+ if (xml_in_abstract)
+ {
+ xml_insert_element (ABSTRACT, END);
+ xml_in_abstract = 0;
+ }
+ if (xml_in_bookinfo)
+ {
+ xml_insert_element (BOOKINFO, END);
+ xml_in_bookinfo = 0;
+ }
if (xml_node_open && ! docbook)
{
if (xml_node_level != -1)
- {
- xml_close_sections (xml_node_level);
- xml_node_level = -1;
- }
+ {
+ xml_close_sections (xml_node_level);
+ xml_node_level = -1;
+ }
xml_insert_element (NODE, END);
}
xml_insert_element (NODE, START);
@@ -706,12 +759,21 @@ void
xml_close_sections (level)
int level;
{
- if (!first_section_opened && in_abstract)
+ if (!first_section_opened)
{
- xml_insert_element (ABSTRACT, END);
- xml_insert_element (BOOKINFO, END);
+ if (xml_in_abstract)
+ {
+ xml_insert_element (ABSTRACT, END);
+ xml_in_abstract = 0;
+ }
+ if (xml_in_bookinfo)
+ {
+ xml_insert_element (BOOKINFO, END);
+ xml_in_bookinfo = 0;
+ }
first_section_opened = 1;
}
+
while (last_section && last_section->level >= level)
{
xml_section *temp = last_section;
@@ -754,10 +816,10 @@ xml_start_menu_entry (tem)
if (xml_in_menu_entry)
{
if (xml_in_menu_entry_comment)
- {
- xml_insert_element (MENUCOMMENT, END);
- xml_in_menu_entry_comment=0;
- }
+ {
+ xml_insert_element (MENUCOMMENT, END);
+ xml_in_menu_entry_comment=0;
+ }
xml_insert_element (MENUENTRY, END);
xml_in_menu_entry=0;
}
@@ -769,7 +831,7 @@ xml_start_menu_entry (tem)
add_word (string);
xml_insert_element (MENUNODE, END);
free (string);
-
+
/* The menu item may use macros, so expand them now. */
xml_insert_element (MENUTITLE, START);
only_macro_expansion++;
@@ -786,7 +848,7 @@ xml_start_menu_entry (tem)
get_until_in_line (0, ".", &string);
free (string);
}
- input_text_offset++; /* discard the second colon or the period */
+ input_text_offset++; /* discard the second colon or the period */
xml_insert_element (MENUCOMMENT, START);
xml_in_menu_entry_comment ++;
}
@@ -797,10 +859,10 @@ xml_end_menu ()
if (xml_in_menu_entry)
{
if (xml_in_menu_entry_comment)
- {
- xml_insert_element (MENUCOMMENT, END);
- xml_in_menu_entry_comment --;
- }
+ {
+ xml_insert_element (MENUCOMMENT, END);
+ xml_in_menu_entry_comment --;
+ }
xml_insert_element (MENUENTRY, END);
xml_in_menu_entry--;
}
@@ -814,61 +876,73 @@ xml_add_char (character)
int character;
{
if (!book_started)
- return;
+ return;
if (docbook && !only_macro_expansion && (in_menu || in_detailmenu))
return;
+
+ if (docbook && xml_table_level && !xml_in_item[xml_table_level] && !in_table_title
+ && !cr_or_whitespace (character) && !in_indexterm)
+ {
+ in_table_title = 1;
+ xml_insert_element (TITLE, START);
+ }
- if (!first_section_opened && !in_abstract && xml_current_element () == TEXINFO
+ if (!first_section_opened && !xml_in_abstract && !xml_in_book_title
&& !xml_no_para && character != '\r' && character != '\n' && character != ' ')
{
- xml_insert_element (BOOKINFO, START);
+ if (!xml_in_bookinfo)
+ {
+ xml_insert_element (BOOKINFO, START);
+ xml_in_bookinfo = 1;
+ }
xml_insert_element (ABSTRACT, START);
- in_abstract = 1;
+ xml_in_abstract = 1;
}
- if (xml_after_table_term && !xml_sort_index)
+ if (xml_after_table_term && !xml_sort_index && !xml_in_xref_token)
{
xml_after_table_term = 0;
xml_insert_element (ITEM, START);
}
-
+
if (xml_just_after_element && !xml_in_para && !inhibit_paragraph_indentation)
{
if (character == '\r' || character == '\n' || character == '\t' || character == ' ')
- return;
- xml_just_after_element = 0;
+ return;
+ xml_just_after_element = 0;
}
-
- if (xml_element_list[xml_current_element()].contains_para
- && !xml_in_para && !only_macro_expansion && !xml_no_para)
+
+ if (xml_element_list[xml_current_element()].contains_para
+ && !xml_in_para && !only_macro_expansion && !xml_no_para
+ && !cr_or_whitespace (character) && !in_fixed_width_font)
{
xml_indent ();
insert_string ("<para>\n");
xml_in_para = 1;
}
-
+
if (xml_in_para)
{
if (character == '\n')
- {
- if (xml_last_character == '\n' && !only_macro_expansion && !xml_no_para
- && xml_element_list[xml_current_element()].contains_para )
- {
- xml_indent_end_para ();
- insert_string ("</para>");
- xml_in_para = 0;
- xml_just_after_element = 1;
- if (xml_in_menu_entry_comment)
- {
- xml_insert_element (MENUCOMMENT, END);
- xml_in_menu_entry_comment = 0;
- xml_insert_element (MENUENTRY, END);
- xml_in_menu_entry = 0;
- }
- }
- }
+ {
+ if (xml_last_character == '\n' && !only_macro_expansion && !xml_no_para
+ && xml_element_list[xml_current_element()].contains_para )
+ {
+ xml_indent_end_para ();
+ insert_string ("</para>");
+ xml_in_para = 0;
+ xml_just_after_element = 1;
+ if (xml_in_menu_entry_comment)
+ {
+ xml_insert_element (MENUCOMMENT, END);
+ xml_in_menu_entry_comment = 0;
+ xml_insert_element (MENUENTRY, END);
+ xml_in_menu_entry = 0;
+ }
+ }
+ }
}
-
+
if (character == '\n' && !xml_in_para && !inhibit_paragraph_indentation)
return;
@@ -880,7 +954,7 @@ xml_add_char (character)
insert_string ("&lt;");
else
insert (character);
-
+
return;
}
@@ -899,9 +973,6 @@ xml_insert_footnote (note)
/*
* Lists and Tables
*/
-static int xml_in_item[256];
-static int xml_table_level = 0;
-
void
xml_begin_table (type, item_function)
enum insertion_type type;
@@ -913,36 +984,36 @@ xml_begin_table (type, item_function)
case vtable:
case table:
/*if (docbook)*/ /* 05-08 */
- {
- xml_insert_element (TABLE, START);
- xml_table_level ++;
- xml_in_item[xml_table_level] = 0;
- }
+ {
+ xml_insert_element (TABLE, START);
+ xml_table_level ++;
+ xml_in_item[xml_table_level] = 0;
+ }
break;
case itemize:
if (!docbook)
- {
- xml_insert_element (ITEMIZE, START);
- xml_table_level ++;
- xml_in_item[xml_table_level] = 0;
- xml_insert_element (ITEMFUNCTION, START);
- if (*item_function == COMMAND_PREFIX
- && item_function[strlen (item_function) - 1] != '}'
- && command_needs_braces (item_function + 1))
- execute_string ("%s{}", item_function);
- else
- execute_string ("%s", item_function);
- xml_insert_element (ITEMFUNCTION, END);
- }
- else
- {
- xml_insert_element_with_attribute (ITEMIZE, START,
- "mark=\"%s\"",
- (*item_function == COMMAND_PREFIX) ?
- &item_function[1] : item_function);
- xml_table_level ++;
- xml_in_item[xml_table_level] = 0;
- }
+ {
+ xml_insert_element (ITEMIZE, START);
+ xml_table_level ++;
+ xml_in_item[xml_table_level] = 0;
+ xml_insert_element (ITEMFUNCTION, START);
+ if (*item_function == COMMAND_PREFIX
+ && item_function[strlen (item_function) - 1] != '}'
+ && command_needs_braces (item_function + 1))
+ execute_string ("%s{}", item_function);
+ else
+ execute_string ("%s", item_function);
+ xml_insert_element (ITEMFUNCTION, END);
+ }
+ else
+ {
+ xml_insert_element_with_attribute (ITEMIZE, START,
+ "mark=\"%s\"",
+ (*item_function == COMMAND_PREFIX) ?
+ &item_function[1] : item_function);
+ xml_table_level ++;
+ xml_in_item[xml_table_level] = 0;
+ }
break;
}
}
@@ -957,22 +1028,28 @@ xml_end_table (type)
case vtable:
case table:
/* if (docbook)*/ /* 05-08 */
- {
- if (xml_in_item[xml_table_level])
- {
- xml_insert_element (ITEM, END);
- xml_insert_element (TABLEITEM, END);
- xml_in_item[xml_table_level] = 0;
- }
- xml_insert_element (TABLE, END);
- xml_table_level --;
- }
+ {
+ if (xml_in_item[xml_table_level])
+ {
+ xml_insert_element (ITEM, END);
+ xml_insert_element (TABLEITEM, END);
+ xml_in_item[xml_table_level] = 0;
+ }
+ xml_insert_element (TABLE, END);
+ xml_table_level --;
+ }
break;
case itemize:
if (xml_in_item[xml_table_level])
+ {
+ xml_insert_element (ITEM, END);
+ xml_in_item[xml_table_level] = 0;
+ }
+ /* gnat-style manual contains an itemized list without items! */
+ if (in_table_title)
{
- xml_insert_element (ITEM, END);
- xml_in_item[xml_table_level] = 0;
+ xml_insert_element (TITLE, END);
+ in_table_title = 0;
}
xml_insert_element (ITEMIZE, END);
xml_table_level --;
@@ -996,9 +1073,14 @@ xml_begin_table_item ()
if (!xml_after_table_term)
{
if (xml_in_item[xml_table_level])
+ {
+ xml_insert_element (ITEM, END);
+ xml_insert_element (TABLEITEM, END);
+ }
+ if (in_table_title)
{
- xml_insert_element (ITEM, END);
- xml_insert_element (TABLEITEM, END);
+ in_table_title = 0;
+ xml_insert_element (TITLE, END);
}
xml_insert_element (TABLEITEM, START);
}
@@ -1021,34 +1103,34 @@ xml_begin_enumerate (enum_arg)
if (!docbook)
xml_insert_element_with_attribute (ENUMERATE, START, "first=\"%s\"", enum_arg);
else
- {
+ {
if (isdigit (*enum_arg))
{
- if (enum_arg[0] == '1')
- xml_insert_element_with_attribute (ENUMERATE, START,
- "numeration=\"Arabic\"", NULL);
- else
- xml_insert_element_with_attribute (ENUMERATE, START,
- "continuation=\"Continues\" numeration=\"Arabic\"", NULL);
+ if (enum_arg[0] == '1')
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "numeration=\"arabic\"", NULL);
+ else
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "continuation=\"continues\" numeration=\"arabic\"", NULL);
}
else if (isupper (*enum_arg))
- {
- if (enum_arg[0] == 'A')
- xml_insert_element_with_attribute (ENUMERATE, START,
- "numeration=\"Upperalpha\"", NULL);
- else
- xml_insert_element_with_attribute (ENUMERATE, START,
- "continuation=\"Continues\" numeration=\"Upperalpha\"", NULL);
+ {
+ if (enum_arg[0] == 'A')
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "numeration=\"upperalpha\"", NULL);
+ else
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "continuation=\"continues\" numeration=\"upperalpha\"", NULL);
}
else
- {
- if (enum_arg[0] == 'a')
- xml_insert_element_with_attribute (ENUMERATE, START,
- "numeration=\"Loweralpha\"", NULL);
- else
- xml_insert_element_with_attribute (ENUMERATE, START,
- "continuation=\"Continues\" numeration=\"Loweralpha\"", NULL);
- }
+ {
+ if (enum_arg[0] == 'a')
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "numeration=\"loweralpha\"", NULL);
+ else
+ xml_insert_element_with_attribute (ENUMERATE, START,
+ "continuation=\"continues\" numeration=\"loweralpha\"", NULL);
+ }
}
xml_table_level ++;
xml_in_item[xml_table_level] = 0;
@@ -1080,34 +1162,34 @@ xml_insert_text_file (name_arg)
int ch;
int save_inhibit_indentation = inhibit_paragraph_indentation;
int save_filling_enabled = filling_enabled;
-
+
xml_insert_element (TEXTOBJECT, START);
xml_insert_element (DISPLAY, START);
inhibit_paragraph_indentation = 1;
filling_enabled = 0;
last_char_was_newline = 0;
-
+
/* Maybe we need to remove the final newline if the image
- file is only one line to allow in-line images. On the
- other hand, they could just make the file without a
- final newline. */
+ file is only one line to allow in-line images. On the
+ other hand, they could just make the file without a
+ final newline. */
while ((ch = getc (image_file)) != EOF)
- add_char (ch);
-
+ add_char (ch);
+
inhibit_paragraph_indentation = save_inhibit_indentation;
filling_enabled = save_filling_enabled;
xml_insert_element (DISPLAY, END);
xml_insert_element (TEXTOBJECT, END);
-
+
if (fclose (image_file) != 0)
- perror (fullname);
+ perror (fullname);
}
else
warning (_("@image file `%s' unreadable: %s"), fullname,
- strerror (errno));
-
+ strerror (errno));
+
free (fullname);
}
@@ -1143,8 +1225,9 @@ xml_asterisk ()
/*
* INDEX
*/
-/* Used to separate primary and secondary entries in an index */
-#define INDEX_SEP ", "
+/* Used to separate primary and secondary entries in an index -- we need
+ to have real multilivel indexing support, not just string analysis. */
+#define INDEX_SEP "@this string will never appear@" /* was , */
xml_insert_indexterm (indexterm, index)
char *indexterm;
@@ -1153,41 +1236,38 @@ xml_insert_indexterm (indexterm, index)
if (!docbook)
{
xml_insert_element_with_attribute (INDEXTERM, START, "index=\"%s\"", index);
+ in_indexterm = 1;
execute_string ("%s", indexterm);
xml_insert_element (INDEXTERM, END);
+ in_indexterm = 0;
}
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))
- {
- primary = xmalloc (strlen (expanded) + 1);
- strcpy (primary, expanded);
- secondary = strstr (primary+1, INDEX_SEP);
- *secondary = '\0';
- secondary += strlen (INDEX_SEP);
- }
+ if (strstr (indexterm+1, INDEX_SEP))
+ {
+ primary = xmalloc (strlen (indexterm) + 1);
+ strcpy (primary, indexterm);
+ secondary = strstr (primary+1, INDEX_SEP);
+ *secondary = '\0';
+ secondary += strlen (INDEX_SEP);
+ }
xml_insert_element_with_attribute (INDEXTERM, START, "role=\"%s\"", index);
+ in_indexterm = 1;
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);
- xml_insert_element (SECONDARY, END);
- }
+ {
+ xml_insert_element (SECONDARY, START);
+ execute_string (secondary);
+ xml_insert_element (SECONDARY, END);
+ }
xml_insert_element (INDEXTERM, END);
- free (expanded);
+ in_indexterm = 0;
}
}
@@ -1197,9 +1277,7 @@ static char last_division_letter = ' ';
static char index_primary[2000]; /** xx no fixed limit */
static int indexdivempty = 0;
-static int in_indexentry = 0;
-static int in_secondary = 0;
-static void
+static void
xml_close_indexentry ()
{
if (!in_indexentry)
@@ -1214,7 +1292,7 @@ xml_close_indexentry ()
void
xml_begin_index ()
{
- /*
+ /*
We assume that we just opened a section, and so that the last output is
<SECTION ID="node-name"><TITLE>Title</TITLE>
where SECTION can be CHAPTER, ...
@@ -1238,11 +1316,15 @@ xml_begin_index ()
xml_last_section_output_position = 0;
xml_pop_current_element (); /* remove section element from elements stack */
-
- last_section = last_section->prev; /* remove section from sections stack */
- free (temp->name);
- free (temp);
-
+
+ if (last_section)
+ last_section = last_section->prev; /* remove section from sections stack */
+ if (temp)
+ {
+ free (temp->name);
+ free (temp);
+ }
+
/* We put <INDEX> */
xml_insert_element (PRINTINDEX, START);
/* Remove the final > */
@@ -1262,9 +1344,9 @@ void
xml_end_index ()
{
xml_close_indexentry ();
- if (xml_index_divisions)
+ if (xml_index_divisions)
xml_insert_element (INDEXDIV, END);
- xml_insert_element (PRINTINDEX, END);
+ xml_insert_element (PRINTINDEX, END);
}
void
@@ -1272,20 +1354,20 @@ xml_index_divide (entry)
char *entry;
{
char c;
- if (strlen (entry) > (strlen (xml_element_list[CODE].name) + 2) &&
- strncmp (entry+1, xml_element_list[CODE].name, strlen (xml_element_list[CODE].name)) == 0)
+ if (strlen (entry) > (strlen (xml_element_list[CODE].name) + 2) &&
+ strncmp (entry+1, xml_element_list[CODE].name, strlen (xml_element_list[CODE].name)) == 0)
c = entry[strlen (xml_element_list[CODE].name)+2];
- else
+ else
c = entry[0];
if (tolower (c) != last_division_letter && isalpha (c))
{
last_division_letter = tolower (c);
xml_close_indexentry ();
if (!indexdivempty)
- {
- xml_insert_element (INDEXDIV, END);
- xml_insert_element (INDEXDIV, START);
- }
+ {
+ xml_insert_element (INDEXDIV, END);
+ xml_insert_element (INDEXDIV, START);
+ }
xml_insert_element (TITLE, START);
insert (toupper (c));
xml_insert_element (TITLE, END);
@@ -1311,23 +1393,23 @@ xml_insert_indexentry (entry, node)
secondary += strlen (INDEX_SEP);
if (in_secondary && strcmp (primary, index_primary) == 0)
- {
- xml_insert_element (SECONDARYIE, END);
- xml_insert_element (SECONDARYIE, START);
- insert_string (secondary);
- }
+ {
+ xml_insert_element (SECONDARYIE, END);
+ xml_insert_element (SECONDARYIE, START);
+ execute_string (secondary);
+ }
else
- {
- xml_close_indexentry ();
- xml_insert_element (INDEXENTRY, START);
- in_indexentry = 1;
- xml_insert_element (PRIMARYIE, START);
- insert_string (primary);
- xml_insert_element (PRIMARYIE, END);
- xml_insert_element (SECONDARYIE, START);
- insert_string (secondary);
- in_secondary = 1;
- }
+ {
+ xml_close_indexentry ();
+ xml_insert_element (INDEXENTRY, START);
+ in_indexentry = 1;
+ xml_insert_element (PRIMARYIE, START);
+ execute_string (primary);
+ xml_insert_element (PRIMARYIE, END);
+ xml_insert_element (SECONDARYIE, START);
+ execute_string (secondary);
+ in_secondary = 1;
+ }
}
else
{
@@ -1335,7 +1417,7 @@ xml_insert_indexentry (entry, node)
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));
@@ -1368,22 +1450,22 @@ xml_begin_multitable (ncolumns, column_widths)
xml_insert_element (MULTITABLE, START);
xml_insert_element_with_attribute (TGROUP, START, "cols=\"%d\"", ncolumns);
for (i=0; i<ncolumns; i++)
- {
- xml_insert_element_with_attribute (COLSPEC, START, "colwidth=\"%d*\"", column_widths[i]);
- xml_pop_current_element ();
- }
+ {
+ xml_insert_element_with_attribute (COLSPEC, START, "colwidth=\"%d*\"", column_widths[i]);
+ xml_pop_current_element ();
+ }
xml_insert_element (TBODY, START);
xml_no_para = 1;
}
- else
+ else
{
xml_insert_element (MULTITABLE, START);
for (i=0; i<ncolumns; i++)
- {
- xml_insert_element (COLSPEC, START);
- add_word_args ("%d", column_widths[i]);
- xml_insert_element (COLSPEC, END);
- }
+ {
+ xml_insert_element (COLSPEC, START);
+ add_word_args ("%d", column_widths[i]);
+ xml_insert_element (COLSPEC, END);
+ }
xml_no_para = 1;
}
}
@@ -1420,7 +1502,7 @@ xml_end_multitable ()
xml_insert_element (MULTITABLE, END);
xml_no_para = 0;
}
- else
+ else
{
xml_insert_element (ENTRY, END);
xml_insert_element (ROW, END);
diff --git a/contrib/texinfo/makeinfo/xml.h b/contrib/texinfo/makeinfo/xml.h
index 0a440ee..35be066 100644
--- a/contrib/texinfo/makeinfo/xml.h
+++ b/contrib/texinfo/makeinfo/xml.h
@@ -1,7 +1,7 @@
/* xml.h -- xml output declarations.
- $Id: xml.h,v 1.7 2002/03/23 20:41:21 karl Exp $
+ $Id: xml.h,v 1.6 2002/11/11 12:37:34 feloy Exp $
- Copyright (C) 2001, 02 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,11 @@ extern int xml_no_para;
extern char *xml_node_id;
extern int xml_last_section_output_position;
+extern int xml_in_xref_token;
+extern int xml_in_bookinfo;
+extern int xml_in_book_title;
+extern int xml_in_abstract;
+
enum xml_element
{
TEXINFO=0, SETFILENAME, TITLEFONT, SETTITLE,
@@ -71,7 +76,7 @@ enum xml_element
IMAGEDATA, TEXTOBJECT,
INDEXENTRY, PRIMARYIE, SECONDARYIE, INDEXDIV,
MULTITABLE, TGROUP, COLSPEC, TBODY, ENTRY, ROW,
- BOOKINFO, ABSTRACT, REPLACEABLE,
+ BOOKINFO, ABSTRACT, REPLACEABLE, ENVAR, COMMENT, FUNCTION, LEGALNOTICE,
PARA
};
OpenPOWER on IntegriCloud