diff options
Diffstat (limited to 'contrib/texinfo/makeinfo/sectioning.c')
-rw-r--r-- | contrib/texinfo/makeinfo/sectioning.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/contrib/texinfo/makeinfo/sectioning.c b/contrib/texinfo/makeinfo/sectioning.c index 761dd397582f..cd04dfa1157b 100644 --- a/contrib/texinfo/makeinfo/sectioning.c +++ b/contrib/texinfo/makeinfo/sectioning.c @@ -1,7 +1,7 @@ /* sectioning.c -- for @chapter, @section, ..., @contents ... - $Id: sectioning.c,v 1.6 2002/11/08 02:21:07 karl Exp $ + $Id: sectioning.c,v 1.10 2003/05/13 16:37:54 karl Exp $ - Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 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 @@ -52,7 +52,7 @@ section_alist_type section_alist[] = { { "heading", 3, ENUM_SECT_NO, TOC_NO }, { "chapheading", 2, ENUM_SECT_NO, TOC_NO }, { "majorheading", 2, ENUM_SECT_NO, TOC_NO }, - + { "top", 1, ENUM_SECT_NO, TOC_YES }, { NULL, 0, 0, 0 } }; @@ -151,7 +151,7 @@ search_sectioning (text) /* ignore the optional command prefix */ if (text[0] == COMMAND_PREFIX) text++; - + for (i = 0; (t = section_alist[i].name); i++) { if (strcmp (t, text) == 0) @@ -161,7 +161,7 @@ search_sectioning (text) } return -1; } - + /* Return an integer which identifies the type section present in TEXT. */ int what_section (text) @@ -215,6 +215,11 @@ void sectioning_underscore (cmd) char *cmd; { + /* If we're not indenting the first paragraph, we shall make it behave + like @noindent is called directly after the section heading. */ + if (! do_first_par_indent) + cm_noindent (); + if (xml) { char *temp; @@ -231,7 +236,7 @@ sectioning_underscore (cmd) 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); @@ -239,8 +244,8 @@ sectioning_underscore (cmd) execute_string ("%s\n", temp); free (temp); xml_insert_element (TITLE, END); - } - else + } + else { char character; char *temp; @@ -300,7 +305,7 @@ handle_enum_increment (level, index) 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 @@ -312,7 +317,7 @@ handle_enum_increment (level, index) /* 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)); @@ -397,6 +402,7 @@ insert_and_underscore (level, with_char, cmd) /* Insert the text following input_text_offset up to the end of the line as an HTML heading element of the appropriate `level' and tagged as an anchor for the current node.. */ + void sectioning_html (level, cmd) int level; @@ -413,8 +419,10 @@ sectioning_html (level, cmd) old_no_indent = no_indent; no_indent = 1; - /* level 0 (chapter) is <h2> */ - add_word_args ("<h%d class=\"%s\">", level + 2, cmd); + /* level 0 (chapter) is <h2>, everything else is <h3>. We don't want + to go lower than that because browsers then start rendering the + headings smaller than the text. */ + add_word_args ("<h%d class=\"%s\">", MIN (3, level + 2), cmd); /* If we are outside of any node, produce an anchor that the TOC could refer to. */ @@ -429,7 +437,7 @@ sectioning_html (level, cmd) /* 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. - + Also, the anchor close must be output before the section name in case the name itself contains an anchor. */ add_word ("</a>"); @@ -535,7 +543,6 @@ cm_top () } else { - TAG_ENTRY *top_node = find_node ("Top"); top_node_seen = 1; /* It is an error to use @top before using @node. */ |