summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/makeinfo/sectioning.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/makeinfo/sectioning.c')
-rw-r--r--contrib/texinfo/makeinfo/sectioning.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/contrib/texinfo/makeinfo/sectioning.c b/contrib/texinfo/makeinfo/sectioning.c
index b06785b..850fc46 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.12 1999/08/17 21:06:50 karl Exp $
+ $Id: sectioning.c,v 1.17 2002/02/09 00:54:51 karl Exp $
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 02 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
@@ -26,6 +26,7 @@
#include "node.h"
#include "toc.h"
#include "sectioning.h"
+#include "xml.h"
/* See comment in sectioning.h. */
section_alist_type section_alist[] = {
@@ -210,11 +211,37 @@ what_section (text)
return -1;
}
-
void
sectioning_underscore (cmd)
char *cmd;
{
+ if (xml)
+ {
+ char *temp;
+ int level;
+ temp = xmalloc (2 + strlen (cmd));
+ temp[0] = COMMAND_PREFIX;
+ strcpy (&temp[1], cmd);
+ level = what_section (temp);
+ level -= 2;
+ 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 */
+ flush_output ();
+ xml_last_section_output_position = output_paragraph_offset;
+
+ xml_insert_element (xml_element (cmd), START);
+ xml_insert_element (TITLE, START);
+ xml_open_section (level, cmd);
+ get_rest_of_line (0, &temp);
+ execute_string ("%s\n", temp);
+ free (temp);
+ xml_insert_element (TITLE, END);
+ }
+ else
+ {
char character;
char *temp;
int level;
@@ -235,6 +262,7 @@ sectioning_underscore (cmd)
{
character = scoring_characters[level];
insert_and_underscore (level, character, cmd);
+ }
}
}
@@ -385,16 +413,22 @@ sectioning_html (level, cmd)
old_no_indent = no_indent;
no_indent = 1;
- add_word_args ("<h%d>", level + 1); /* level 0 is <h1> */
+ add_word_args ("<h%d>", level + 2); /* level 0 (chapter) is <h2> */
/* If we are outside of any node, produce an anchor that
the TOC could refer to. */
if (!current_node || !*current_node)
{
+ static const char a_name[] = "<a name=\"";
+
starting_pos = output_paragraph + output_paragraph_offset;
- add_word_args ("<a name=\"TOC%d\">", toc_ref_count++);
- toc_anchor = substring (starting_pos + 9,
+ add_word_args ("%sTOC%d\">", a_name, toc_ref_count++);
+ 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. */
+ add_word ("</a>");
}
starting_pos = output_paragraph + output_paragraph_offset;
@@ -431,13 +465,13 @@ sectioning_html (level, cmd)
if (section_alist[index].toc == TOC_YES)
toc_add_entry (substring (starting_pos, ending_pos),
level, current_node, toc_anchor);
-
+
free (temp);
if (outstanding_node)
outstanding_node = 0;
- add_word_args ("</h%d>", level+1);
+ add_word_args ("</h%d>", level + 2);
close_paragraph();
filling_enabled = 1;
no_indent = old_no_indent;
@@ -488,14 +522,8 @@ cm_top ()
{
if (tag->flags & TAG_FLAG_IS_TOP)
{
- int old_line_number = line_number;
- char *old_input_filename = input_filename;
-
- line_number = tag->line_no;
- input_filename = tag->filename;
- line_error (_("Here is the %ctop node"), COMMAND_PREFIX);
- input_filename = old_input_filename;
- line_number = old_line_number;
+ file_line_error (tag->filename, tag->line_no,
+ _("Here is the %ctop node"), COMMAND_PREFIX);
return;
}
tag = tag->next_ent;
@@ -506,7 +534,7 @@ cm_top ()
TAG_ENTRY *top_node = find_node ("Top");
top_node_seen = 1;
- /* It is an error to use @top before you have used @node. */
+ /* It is an error to use @top before using @node. */
if (!tag_table)
{
char *top_name;
@@ -518,21 +546,6 @@ cm_top ()
free (top_name);
return;
}
- else if (html && splitting)
- {
- char *next = top_node ? top_node->next : NULL;
-
- add_word ("<p>");
- if (next)
- {
- add_word (_("Next:"));
- add_word ("<a rel=next href=\"");
- add_anchor_name (next, 1);
- add_word ("\">");
- execute_string (next);
- add_word ("</a>\n");
- }
- }
cm_unnumbered ();
OpenPOWER on IntegriCloud