[Sorry to throw all this on you guys all at once, but I'm on a roll,
and it would be nice to fix as many annoyances before the next release
as we can. Thanks for your help and patience!]
I have two related problems relating to navigation headers that
are not at the top of a page - i.e. "internal" and "at-end".
I'd like to remove the non-initial non-final headers.
Assuming --split=section, I'd like to remove all the headers
generated for @subsection and @subsubsection. While I agree they
may have some value, I think the extra "clutter" makes them a net
negative, especially when we have the js-info sidebar for navigation.
We can do this with CSS:
div.subsection div.header { display: none }
However, this has the downside that it also hides the end-of-page
navigation header, which I think is useful.
The problem is that the end-of-page header is emitted inside the
final @subsection. I think it should be emitted outside the
final @subsection.
A related problem is that the end-of-page header is relative to the
final @subsection (and duplicates that internal header at the start
of the @subsection). In my opinion, the header should point to
the next/previous/up of the @section (or @chapter for a chapter
without sections). This is more logical, I think, whether or not
the @subsecton navigation headers are displayed.
The attached patch is a kludgy proof-of-concept, and assumes
SECTION_FOOTER_BUTTONS=0. I'm not sure what configuration options
make sense, and what should be the defaults, but combination of
the patch, plus setting SECTION_FOOTER_BUTTONS=0, plus the above CSS rule
seems to work for me. I also think the result HTML output makes
a good default, and it makes it easy to use CSS to hide the internal headers,
depending on individual preference.
--
--Per Bothner
[email protected] http://per.bothner.com/
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 1fe5ce4912..a5347d100d 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2444,12 +2444,28 @@ sub _convert_heading_command($$$$$)
return $result;
}
+ my $element;
+ if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
+ and $command->{'parent'}
+ and $command->{'parent'}->{'type'}
+ and $command->{'parent'}->{'type'} eq 'element') {
+ $element = $command->{'parent'};
+ }
+ my $element_header;
+ if ($element) {
+ $element_header = &{$self->{'format_element_header'}}($self, $cmdname,
+ $command, $element);
+ }
my $section = $command->{'extra'}->{'associated_section'};
my $node;
if ($section) {
my $level = $section->{'level'};
$result .= join('', $self->close_registered_sections_level($level));
- $self->register_opened_section_level($level, "</div>\n");
+ my $close = "</div>\n";
+ if ($element_header and ! @{$self->{'pending_closes'}}) {
+ $close = $element_header . $close;
+ }
+ $self->register_opened_section_level($level, $close);
} else {
$node = $command->{'extra'}->{'associated_node'};
}
@@ -2469,16 +2485,8 @@ sub _convert_heading_command($$$$$)
print STDERR "Process $command "
.Texinfo::Structuring::_print_root_command_texi($command)."\n"
if ($self->get_conf('DEBUG'));
- my $element;
- if ($Texinfo::Common::root_commands{$command->{'cmdname'}}
- and $command->{'parent'}
- and $command->{'parent'}->{'type'}
- and $command->{'parent'}->{'type'} eq 'element') {
- $element = $command->{'parent'};
- }
if ($element) {
- $result .= &{$self->{'format_element_header'}}($self, $cmdname,
- $command, $element);
+ $result .= $element_header;
}
my $heading_level;