### link target)
### -) The HTML anchors for all sections are derived from the node name /
### section title (pre-generated in the .xref-map file). Implemented by:
-### lilypond_node_file_name (adjust node anchors)
### split_at_numbered_sections (adjust section anchors)
+### -) Use the standard footnote format "<sup>nr</sup> text" instead of the
+### ugly format of texi2html (<h3>(nr)</h3><p>text</p>). Implemented in
+### lilypond_foot_line_and_ref
###
###
### Useful helper functions:
$Texi2HTML::Config::USE_ACCESSKEY = 1;
$Texi2HTML::Config::USE_LINKS = 1;
$Texi2HTML::Config::USE_REL_REV = 1;
+$Texi2HTML::Config::SEPARATED_FOOTNOTES = 0; # Print footnotes on same page, not separated
$Texi2HTML::Config::element_file_name = \&split_at_numbered_sections;
-# $Texi2HTML::Config::node_file_name = \&lilypond_node_file_name;
$Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
$Texi2HTML::Config::print_page_foot = \&print_lilypond_page_foot;
$Texi2HTML::Config::print_navigation = \&lilypond_print_navigation;
$Texi2HTML::Config::css_lines = \&lilypond_css_lines;
$Texi2HTML::Config::unknown = \&lilypond_unknown;
$Texi2HTML::Config::print_page_head = \&lilypond_print_page_head;
+$Texi2HTML::Config::foot_line_and_ref = \&lilypond_foot_line_and_ref;
# Examples should be formatted similar to quotes:
$Texi2HTML::Config::complex_format_map->{'example'} = {
'end' => q{"</pre></blockquote>\n"},
};
+%Texi2HTML::config::misc_pages_targets = (
+ 'Overview' => 'Overview',
+ 'Contents' => 'Contents',
+ 'About' => 'About'
+);
+
my @section_to_filename;
my $node_to_filename_map = ();
-# modify the anchors for nodes, in particular, use the section<=>anchor map
-# from the .xref-map file and assign the pre-defined anchor to the node.
-# We don't want to split at nodes, so we don't return a valid file name
-# and just mis-use this function to change the node->{'id'}
-sub lilypond_node_file_name($$)
-{
- my $node = shift;
- my $type = shift;
- my $node_name = main::remove_texi($node->{'texi'});
-
- if (exists ($node_to_filename_map->{$node_name})) {
- (my $filename, my $anchor) = @{$node_to_filename_map->{$node_name}};
- $node->{'id'} = $anchor;
- } elsif ($type eq "top" or $type eq "toc" or $type eq "doc"
- or $type eq "stoc" or $type eq "foot" or $type eq "about") {
- # Nothing to do
- } else {
- my $anchor = $node_name;
- if ($node->{translationof}) {
- $anchor = main::remove_texi($node->{translationof});
- }
- # normalize to the same file name as texinfo
- $anchor = texinfo_file_name($anchor);
- $node->{'id'} = $anchor;
- }
- return undef;
-}
-
-
# This function makes sure that files are only generated for numbered sections,
# but not for unnumbered ones. It is called after texi2html has done its own
# splitting and simply returns the filename for the node given as first argument
(my $filename, my $anchor) = @{$node_to_filename_map->{$node_name}};
$filename .= ".$docu_ext" if (defined($docu_ext));
- $element->{'id'} = $anchor;
-# $element->{'node_ref'}->{'id'} = $anchor;
+ # need to override both target (used as anchor in links to this section) and
+ # id (used in the <a name=..> tag for this section)!
+ $element->{'id'} = $element->{'target'} = $anchor;
+
# unnumbered sections (except those at top-level!) always go to the same
# file as the previous numbered section
if (not ($element->{number}) and not ($lastfilename eq '') and ($element->{level} > 1)) {
} elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or $type eq "stoc" or $type eq "foot" or $type eq "about") {
# TOC, footer, about etc. are called with undefined $element and $type == "toc"|"stoc"|"foot"|"about"
+ if ($type eq "top") {
+ $element->{'id'} = $element->{'target'} = "Top";
+ }
return;
} else {
print STDERR "WARNING: Node '$node_name' was NOT found in the map\n"
}
# normalize to the same file name as texinfo
$anchor = texinfo_file_name($anchor);
- $element->{'id'} = $anchor;
- $element->{'node_ref'}->{'id'} = $anchor;
+ # need to override both target (used as anchor in links to this section) and
+ # id (used in the <a name=..> tag for this section)!
+ $element->{'id'} = $element->{'target'} = $anchor;
# Numbered sections will get a filename Node_title, unnumbered sections will use
# the file name of the previous numbered section:
if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
+#############################################################################
+### FOOTNOTE FORMATTING
+#############################################################################
+
+# Format footnotes in a nicer way: Instead of printing the number in a separate
+# (nr) heading line, use the standard way of prepending <sup>nr</sup> immediately
+# before the fn text.
+sub lilypond_foot_line_and_ref($$$$$$$)
+{
+ my $number_in_doc = shift;
+ my $number_in_page = shift;
+ my $footnote_id = shift;
+ my $place_id = shift;
+ my $document_file = shift;
+ my $footnote_file = shift;
+ my $lines = shift;
+ my $state = shift;
+
+ if ($document_file eq $footnote_file)
+ {
+ $document_file = $footnote_file = '';
+ }
+ # FN number printed before the fn text:
+ my $tmptxt = &$anchor($footnote_id, $document_file . "#$place_id",
+ "<sup>$number_in_doc</sup>");
+ # unfortunately, the @$lines contain the already formatted footnote in the
+ # from <p>...</p>. This means that we have to modify this string and
+ # insert the FN number manually. The default (nr) on a separate line before
+ # the FN text is just plain ugly:
+ $lines->[0] =~ s/<p>/<p>$tmptxt /;
+ # this is a bit obscure, this allows to add an anchor only if formatted
+ # as part of the document.
+ $place_id = '' if ($state->{'outside_document'} or $state->{'multiple_pass'});
+ # return FN lines and text to be inserted in the running text (link to FN)
+ return ($lines, &$anchor($place_id, $footnote_file . "#$footnote_id",
+ "<sup>$number_in_doc</sup>"));
+}
+
+
+
#############################################################################
### OTHER SETTINGS
#############################################################################