2 # -*- coding: utf-8; -*-
4 ### texi2html customization script for LilyPond
5 ### Author: Reinhold Kainhofer <reinhold@kainhofer.com>, 2008.
6 ### Some code parts copied from texi2html and adapted. These functions
7 ### were written mainly by Patrice Dumas
11 ### Features implemented here:
12 ### -) For split manuals, the main page is index.html.
13 ### -) All @unnumbered* sections are placed into the same file
14 ### (implemented by split_at_numbered_sections)
15 ### -) Use our custom CSS file, with IE-specific fixes in another CSS file,
16 ### impelmented by lilypond_css_lines
17 ### -) TOC (folded, with the current page highlighted) in an overflown <div>
18 ### is added to every page; implemented by:
19 ### lilypond_print_element_header -- building of the TOC
20 ### lilypond_toc_body -- generation of customized TOC output
21 ### lilypond_print_page_head -- start <div id="main">
22 ### print_lilypond_page_foot -- closing id=main, output of footer & TOC
23 ### -) External refs are formatted only as "Text of the node" (not as >>see
24 ### "NODE" section "SECTION" in "BOOK"<< like with default texi2html). Also,
25 ### the leading "(book-name)" is removed.
26 ### Implemented by overriding lilypond_external_ref
27 ### -) Navigation bars on top/bottom of the page and between sections are not
28 ### left-aligned, but use a combination of left/center/right aligned table
29 ### cells; For this, I heavily extend the texi2html code to allow for
30 ### differently aligned cells and for multi-line tables);
31 ### Implemented in lilypond_print_navigation
32 ### -) Different formatting than the default: example uses the same formatting
34 ### -) Allow translated section titles: All section titles can be translated,
35 ### the original (English) title is associated with @translationof. This is
36 ### needed, because the file name / anchor is generated from the original
37 ### English title, since otherwise language-autoselection would break with
39 ### Since it is then no longer possible to obtain the file name from the
40 ### section title, I keep a sectionname<=>filename/anchor around. This way,
41 ### xrefs from other manuals can simply load that map and retrieve the
42 ### correct file name for the link. Implemented in:
43 ### lilypond_unknown (handling of @translationof, in case
44 ### extract_texi_filenames.py messes up...)
45 ### lilypond_element_file_name (correct file name: use the map)
46 ### lilypond_element_target_name (correct anchor: use the map)
47 ### lilypond_init_map (read in the externally created map from disk)
48 ### lilypond_external_href (load the map for xrefs, use the correct
50 ### -) The HTML anchors for all sections are derived from the node name /
51 ### section title (pre-generated in the .xref-map file). Implemented by:
52 ### lilypond_element_target_name (adjust section anchors)
53 ### -) Use the standard footnote format "<sup>nr</sup> text" instead of the
54 ### ugly format of texi2html (<h3>(nr)</h3><p>text</p>). Implemented in
55 ### makeinfo_like_foot_line_and_ref
56 ### makeinfo_like_foot_lines
57 ### makeinfo_like_paragraph
60 ### Useful helper functions:
61 ### -) texinfo_file_name($node_name): returns a texinfo-compatible file name
62 ### for the given string $node_name (whitespace trimmed/replaced by -,
63 ### non-standard chars replaced by _xxxx (ascii char code) and forced to
64 ### start with a letter by prepending t_g if necessary)
67 package Texi2HTML::Config;
70 use Encode qw(decode);
72 #############################################################################
74 #############################################################################
76 my $LY_LANGUAGES = {};
77 $LY_LANGUAGES->{'fr'} = {
78 'Back to Documentation Index' => 'Retour à l\'accueil de la documentation',
80 $LY_LANGUAGES->{'es'} = {
81 'Back to Documentation Index' => 'Volver al índice de la documentación',
83 $LY_LANGUAGES->{'de'} = {
84 'Back to Documentation Index' => 'Zur Dokumentationsübersicht',
86 $LY_LANGUAGES->{'ja'} = {
87 'Back to Documentation Index' => 'ドキュメント インデックスに戻る',
90 $LY_LANGUAGES->{'hu'} = {
91 'Back to Documentation Index' => 'Vissza a dokumentációk jegyzékéhez',
94 # FIXME: send the translation below to texi2html/texinfo devs
95 $LANGUAGES->{'hu'} = {
96 ' The buttons in the navigation panels have the following meaning:' => ' A navigációs panelen levő gombok jelentése a következő:',
97 ' where the @strong{ Example } assumes that the current position is at @strong{ Subsubsection One-Two-Three } of a document of the following structure:' => ' ahol a @strong{ Példa } feltételezi, hogy az aktuális pozíció az @strong{ 1-2-3 alalszakasz } egy olyan dokumentumban, melynek szerkezete a következő:',
99 '(outside of any element)' => '(bármelyik elemen kívül)',
100 '(outside of any node)' => '(bármelyik csomóponton kívül)',
101 '@b{{quotation_arg}:} ' => '@b{{quotation_arg}:} ',
102 '@cite{{book}}' => '@cite{{book}}',
103 '@{No value for `{value}\'@}' => '@{Nincs értéke ennek: `{value}\'@}',
104 'About' => 'Névjegy',
105 'About (help)' => 'Névjegy (súgó)',
106 'About This Document' => 'Erről a dokumentumról',
107 'April' => 'április',
108 'August' => 'augusztus',
110 'Back section in previous file' => 'Előző fájl hátsó szakasza',
111 'Beginning of this chapter or previous chapter' => 'Fejezet eleje vagy előző fejezet',
113 'Contents' => 'Tartalom',
114 'Cover (top) of document' => 'Dokumentum borítója',
115 'Current' => 'Aktuális',
116 'Current Position' => 'Aktuális pozíció',
117 'Current section' => 'Aktuális szakasz',
118 'December' => 'december',
119 'FastBack' => 'Gyorsan vissza',
120 'FastForward' => 'Gyorsan előre',
121 'February' => 'február',
123 'First section in reading order' => 'Első szakasz az olvasási sorrendben',
124 'Following' => 'Következő',
125 'Following node' => 'Következő csomópont',
126 'Footnotes' => 'Lábjegyzet',
127 'Forward' => 'Előre',
128 'Forward section in next file' => 'Következő fájl elülső szakasza',
129 'From 1.2.3 go to' => '1.2.3-ból menj ide:',
130 'Go to' => 'Menj ide:',
131 'Index' => 'Tárgymutató',
132 'Index Entry' => 'Tárgymutató-bejegyzés',
133 'January' => 'január',
135 'Jump to' => 'Ugorj ide:',
138 'Last section in reading order' => 'Utolsó szakasz az olvasási sorrendben',
139 'March' => 'március',
143 'Next' => 'Következő',
144 'Next chapter' => 'Következő fejezet',
145 'Next file' => 'Következő fájl',
146 'Next node' => 'Következő csomópont',
147 'Next section in reading order' => 'Következő szakasz az olvasási sorrendben',
148 'Next section on same level' => 'Következő szakasz ugyanazon a szinten',
149 'NextFile' => 'KövetkezőFájl',
150 'Node following in node reading order' => 'Következő csomópont az olvasási sorrendben',
151 'Node up' => 'Szülő csomópont',
152 'NodeNext' => 'KövetkezőCsomópont',
153 'NodePrev' => 'ElőzőCsomópont',
154 'NodeUp' => 'SzülőCsomópont',
155 'November' => 'november',
156 'October' => 'október',
157 'Overview' => 'Áttekintés',
159 'PrevFile' => 'ElőzőFájl',
160 'Previous' => 'Előző',
161 'Previous file' => 'Előző fájl',
162 'Previous node' => 'Előző csomópont',
163 'Previous section in reading order' => 'Előző szakasz az olvasási sorrendben',
164 'Previous section on same level' => 'Előző szakasz ugyanazon a szinten',
165 'Section' => 'Szakasz',
166 'Section One' => '1. szakasz',
168 'See @cite{{book}}' => 'Ld. @cite{{book}}',
169 'See section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
170 'See section `{section}\' in @cite{{book}}' => 'Ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
171 'See section {reference_name}' => 'Ld. ezt a szakaszt: {reference_name}',
172 'See {node_file_href}' => 'Ld. {node_file_href}',
173 'See {node_file_href} @cite{{book}}' => 'See {node_file_href} @cite{{book}}',
174 'See {node_file_href} section `{section}\' in @cite{{book}}' => 'Ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
175 'See {reference_name}' => 'Ld. {reference_name}',
176 'See {ref}' => 'Ld. {ref}',
177 'See {title_ref}' => 'Ld. {title_ref}',
178 'September' => 'szeptember',
179 'Short Table of Contents' => 'Rövid tartalomjegyzék',
180 'Short table of contents' => 'Rövid tartalomjegyzék',
181 'Subsection One-Four' => '1-4 alszakasz',
182 'Subsection One-One' => '1-1 alszakasz',
183 'Subsection One-Three' => '1-3 alszakasz',
184 'Subsection One-Two' => '1-2 alszakasz',
185 'Subsubsection One-Two-Four' => '1-2-4 alalszakasz',
186 'Subsubsection One-Two-One' => '1-2-1 alalszakasz',
187 'Subsubsection One-Two-Three' => '1-2-3 alalszakasz',
188 'Subsubsection One-Two-Two' => '1-2-2 alalszakasz',
189 'T2H_today' => '%s, %d %d',
190 'Table of Contents' => 'Tartalomjegyzék',
191 'Table of contents' => 'Tartalomjegyzék',
192 'The node you are looking for is at {href}.' => 'A keresett csomópont itt található: {href}.',
194 'This document was generated on @i{{date}} using @uref{{program_homepage}, @i{{program}}}.' => 'Ezt a dokumentumot @i{{date}} napon generálta a(z) @uref{{program_homepage}, @i{{program}}}.',
195 'This document was generated using @uref{{program_homepage}, @emph{{program}}}.' => 'Ezt a dokumentumot a(z) @uref{{program_homepage}, @emph{{program}}} generálta.',
197 'Untitled Document' => 'Névtelen dokumentum',
199 'Up node' => 'Szülő csomópont',
200 'Up section' => 'Szülő szakasz',
201 'current' => 'aktuális',
202 'on @emph{{date}}' => 'ekkor: @emph{{date}}',
203 'section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'szakasz: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
204 'section `{section}\' in @cite{{book}}' => 'szakasz: `{section}\' itt: @cite{{book}}',
206 'see @cite{{book}}' => 'ld. @cite{{book}}',
207 'see section `@asis{}`{section_name}\'@asis{}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `@asis{}`{section_name}\'@asis{}\' itt: @cite{{book}}',
208 'see section `{section}\' in @cite{{book}}' => 'ld. ezt a szakaszt: `{section}\' itt: @cite{{book}}',
209 'see section {reference_name}' => 'ld. ezt a szakaszt: {reference_name}',
210 'see {node_file_href}' => 'ld. {node_file_href}',
211 'see {node_file_href} @cite{{book}}' => 'ld. {node_file_href} @cite{{book}}',
212 'see {node_file_href} section `{section}\' in @cite{{book}}' => 'ld. {node_file_href} ezt a szakaszt: `{section}\' itt: @cite{{book}}',
213 'see {reference_name}' => 'ld. {reference_name}',
214 'see {ref}' => 'ld. {ref}',
215 'see {title_ref}' => 'ld. {title_ref}',
216 '{acronym_like} ({explanation})' => '{acronym_like} ({explanation})',
217 '{name} of {class}' => '{name} típusa: {class}',
218 '{name} on {class}' => '{name} ezen: {class}',
219 '{node_file_href}' => '{node_file_href}',
220 '{node_file_href} @cite{{book}}' => '{node_file_href} @cite{{book}}',
221 '{node_file_href} section `{section}\' in @cite{{book}}' => '{node_file_href} szakasz: `{section}\' itt: @cite{{book}}',
222 '{reference_name}' => '{reference_name}',
224 '{style} {number}' => '{style} {number}',
225 '{style}: {caption_first_line}' => '{style}: {caption_first_line}',
226 '{style}: {shortcaption_first_line}' => '{style}: {shortcaption_first_line}',
227 '{title_ref}' => '{title_ref}'
230 sub ly_get_string () {
231 my $lang = $Texi2HTML::THISDOC{current_lang};
233 if ($lang and $lang ne "en" and $LY_LANGUAGES->{$lang}->{$string}) {
234 return $LY_LANGUAGES->{$lang}->{$string};
241 #############################################################################
242 ### FUNCTIONALITY FOR MAIN WEB PAGES
243 #############################################################################
246 sub lilypond_init_web_manual ()
248 if (exists($main::value{'web_manual'}))
250 print STDERR "Initializing settings for web site\n";
255 push @Texi2HTML::Config::command_handler_process, \&lilypond_init_web_manual;
257 #############################################################################
258 ### SETTINGS FOR TEXI2HTML
259 #############################################################################
261 # Validation fix for texi2html<=1.82
262 $Texi2HTML::Config::DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
266 @Texi2HTML::Config::CSS_REFS = (
267 {FILENAME => "lilypond-web.css", TITLE => "Default style"}
270 @Texi2HTML::Config::CSS_REFS = (
271 {FILENAME => "lilypond-mccarty.css", TITLE => "Patrick McCarty's design"}
275 @Texi2HTML::Config::ALT_CSS_REFS = (
276 {FILENAME => "lilypond.css", TITLE => "Andrew Hawryluk's design" },
277 {FILENAME => "lilypond-blue.css", TITLE => "Kurt Kroon's blue design" },
279 $Texi2HTML::Config::USE_ACCESSKEY = 1;
280 $Texi2HTML::Config::USE_LINKS = 1;
281 $Texi2HTML::Config::USE_REL_REV = 1;
282 $Texi2HTML::Config::SPLIT_INDEX = 0;
283 $Texi2HTML::Config::SEPARATED_FOOTNOTES = 0; # Print footnotes on same page, not separated
285 if ($Texi2HTML::Config::SPLIT eq 'section' or
286 $Texi2HTML::Config::SPLIT eq 'subsubsection') {
287 $Texi2HTML::Config::element_file_name = \&lilypond_element_file_name;
290 $Texi2HTML::Config::element_target_name = \&lilypond_element_target_name;
291 $default_print_element_header = $Texi2HTML::Config::print_element_header;
292 $Texi2HTML::Config::print_element_header = \&lilypond_print_element_header;
293 $Texi2HTML::Config::print_page_foot = \&print_lilypond_page_foot;
294 $Texi2HTML::Config::print_navigation = \&lilypond_print_navigation;
295 $Texi2HTML::Config::external_ref = \&lilypond_external_ref;
296 $default_external_href = $Texi2HTML::Config::external_href;
297 $Texi2HTML::Config::external_href = \&lilypond_external_href;
298 $default_toc_body = $Texi2HTML::Config::toc_body;
299 $Texi2HTML::Config::toc_body = \&lilypond_toc_body;
300 $Texi2HTML::Config::css_lines = \&lilypond_css_lines;
301 $default_unknown = $Texi2HTML::Config::unknown;
302 $Texi2HTML::Config::unknown = \&lilypond_unknown;
303 $default_print_page_head = $Texi2HTML::Config::print_page_head;
304 $Texi2HTML::Config::print_page_head = \&lilypond_print_page_head;
305 # $Texi2HTML::Config::foot_line_and_ref = \&lilypond_foot_line_and_ref;
306 $Texi2HTML::Config::foot_line_and_ref = \&makeinfo_like_foot_line_and_ref;
307 $Texi2HTML::Config::foot_lines = \&makeinfo_like_foot_lines;
308 $Texi2HTML::Config::paragraph = \&makeinfo_like_paragraph;
312 # Examples should be formatted similar to quotes:
313 $Texi2HTML::Config::complex_format_map->{'example'} = {
314 'begin' => q{"<blockquote>"},
315 'end' => q{"</blockquote>\n"},
319 %Texi2HTML::config::misc_pages_targets = (
320 'Overview' => 'Overview',
321 'Contents' => 'Contents',
326 my @section_to_filename;
331 #############################################################################
333 #############################################################################
336 $Data::Dumper::Maxdepth = 2;
338 sub print_element_info($)
341 print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
342 print "Element: $element\n";
343 print Dumper($element);
350 #############################################################################
352 #############################################################################
354 # Convert a given node name to its proper file name (normalization as explained
355 # in the texinfo manual:
356 # http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref-Node-Name-Expansion.html
357 sub texinfo_file_name($)
361 # File name normalization by texinfo:
362 # 1/2: letters and numbers are left unchanged
363 # 3/4: multiple, leading and trailing whitespace is removed
364 $text = main::normalise_space($text);
365 # 5/6: all remaining spaces are converted to '-', all other 7- or 8-bit
366 # chars are replaced by _xxxx (xxxx=ascii character code)
367 while ($text ne '') {
368 if ($text =~ s/^([A-Za-z0-9]+)//o) { # number or letter stay unchanged
370 } elsif ($text =~ s/^ //o) { # space -> '-'
372 } elsif ($text =~ s/^(.)//o) { # Otherwise use _xxxx (ascii char code)
374 if ( $ccode <= 0xFFFF ) {
375 $result .= sprintf("_%04x", $ccode);
377 $result .= sprintf("__%06x", $ccode);
381 # 7: if name does not begin with a letter, prepend 't_g' (so it starts with a letter)
382 if ($result !~ /^[a-zA-Z]/) {
383 $result = 't_g' . $result;
389 # Load a file containing a nodename<=>filename map (tab-sepatared, i.e.
390 # NODENAME\tFILENAME\tANCHOR
391 # Returns a ref to a hash "Node title" => ["FilenameWithoutExt", "Anchor"]
392 sub load_map_file ($)
397 # For some unknown reason, Perl on my system (5.10.0 on Fedora 12)
398 # refuses to open map files of translated documents with
399 # '<:encoding(utf8)', but decoding from UTF-8 line by line works. -jm
400 if (open(XREFFILE,'<', $mapfile)) {
402 while ( $line = decode ('UTF-8', <XREFFILE>) ) {
403 # parse the tab-separated entries and insert them into the map:
405 my @entries = split(/\t/, $line);
406 if (scalar (@entries) == 3) {
407 $node_map->{$entries[0]} = [$entries[1], $entries[2]];
409 print STDERR "Invalid entry in the node file $mapfile: $line\n";
412 # print STDERR %{$node_map};
415 print STDERR "WARNING: Unable to load the map file $mapfile\n";
421 # Split the given path into dir and basename (with .texi removed). Used mainly
422 # to get the path/basename of the original texi input file
423 sub split_texi_filename ($)
426 my ($docu_dir, $docu_name);
427 if ($docu =~ /(.*\/)/) {
428 chop($docu_dir = $1);
430 $docu_name =~ s/.*\///;
435 $docu_name =~ s/\.te?x(i|info)?$//;
436 return ($docu_dir, $docu_name);
443 #############################################################################
445 #############################################################################
447 # Include our standard CSS file, not hard-coded CSS code directly in the HTML!
448 # For IE, conditionally include the lilypond-ie-fixes.css style sheet
449 sub lilypond_css_lines ($$)
451 my $import_lines = shift;
452 my $rule_lines = shift;
453 return if (defined($Texi2HTML::THISDOC{'CSS_LINES'}));
454 if (@$rule_lines or @$import_lines)
456 $Texi2HTML::THISDOC{'CSS_LINES'} = "<style type=\"text/css\">\n<!--\n";
457 $Texi2HTML::THISDOC{'CSS_LINES'} .= join('',@$import_lines) . "\n" if (@$import_lines);
458 $Texi2HTML::THISDOC{'CSS_LINES'} .= join('',@$rule_lines) . "\n" if (@$rule_lines);
459 $Texi2HTML::THISDOC{'CSS_LINES'} .= "-->\n</style>\n";
461 foreach my $ref (@CSS_REFS)
463 $Texi2HTML::THISDOC{'CSS_LINES'} .= "<link rel=\"stylesheet\" type=\"text/css\" title=\"$ref->{TITLE}\" href=\"$ref->{FILENAME}\">\n";
465 foreach my $ref (@Texi2HTML::Config::ALT_CSS_REFS)
467 $Texi2HTML::THISDOC{'CSS_LINES'} .= "<link rel=\"alternate stylesheet\" type=\"text/css\" href=\"$ref->{FILENAME}\" title=\"$ref->{TITLE}\">\n";
469 # FIXME: the website doesn't use ie7-specific fixes; do the
470 # docs still need this? -gp
471 $Texi2HTML::THISDOC{'CSS_LINES'} .= "<!--[if lte IE 7]>\n<link href=\"lilypond-ie-fixes.css\" rel=\"stylesheet\" type=\"text/css\">\n<![endif]-->\n";
478 #############################################################################
479 ### SPLITTING BASED ON NUMBERED SECTIONS
480 #############################################################################
484 my $node_to_filename_map = ();
487 # This function makes sure that files are only generated for numbered sections,
488 # but not for unnumbered ones. It is called after texi2html has done its own
489 # splitting and simply returns the filename for the node given as first argument
490 # Nodes with the same filename will be printed out to the same filename, so
491 # this really all we need. Also, make sure that the file names for sections
492 # are derived from the section title. We also might want to name the anchors
493 # according to node titles, which works by simply overriding the id element of
495 # If an external nodename<=>filename/anchor map file is found (loaded in
496 # the command handler, use the externally created values, otherwise use the
498 sub lilypond_element_file_name($$$)
502 my $docu_name = shift;
503 my $docu_ext = $Texi2HTML::Config::EXTENSION;
505 my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
506 # the snippets page does not use nodes for the snippets, so in this case
507 # we'll have to use the section name!
508 if ($node_name eq '') {
509 $node_name = main::remove_texi($element->{'texi'});
512 # If we have an entry in the section<=>filename map, use that one, otherwise
513 # generate the filename/anchor here. In the latter case, external manuals
514 # will not be able to retrieve the file name for xrefs!!! Still, I already
515 # had that code, so I'll leave it in in case something goes wrong with the
516 # extract_texi_filenames.py script in the lilypond build process!
517 if (exists ($node_to_filename_map->{$node_name})) {
518 (my $filename, my $anchor) = @{$node_to_filename_map->{$node_name}};
519 $filename .= ".$docu_ext" if (defined($docu_ext));
521 # unnumbered sections (except those at top-level!) always go to the same
522 # file as the previous numbered section
523 if (not ($element->{number}) and not ($lastfilename eq '') and ($element->{level} > 1)) {
524 $filename = $lastfilename;
526 if (($filename eq $lastfilename)) {
527 $$element{doc_nr} = $docnr;
530 $$element{doc_nr} = $docnr;
531 $lastfilename = $filename;
533 # print STDERR "File name: $filename\n";
534 return lc($filename);
536 } elsif ($type eq "top" or $type eq "toc" or $type eq "doc" or $type eq "stoc" or $type eq "foot" or $type eq "about") {
539 print STDERR "WARNING: Node '$node_name' was NOT found in the map\n"
540 unless ($node_name eq '') or ($element->{'tag'} eq 'unnumberedsec')
541 or ($node_name =~ /NOT REALLY USED/);
543 # Numbered sections will get a filename Node_title, unnumbered sections will use
544 # the file name of the previous numbered section:
545 if (($element->{number}) or ($lastfilename eq '') or ($element->{level} == 1)) {
546 # normalize to the same file name as texinfo
547 if ($element->{translationof}) {
548 $node_name = main::remove_texi($element->{translationof});
550 my $filename = texinfo_file_name($node_name);
551 $filename .= ".$docu_ext" if (defined($docu_ext));
553 $$element{doc_nr} = $docnr;
554 $lastfilename = $filename;
555 print STDERR "File name: $filename\n";
556 return lc($filename);
558 $$element{doc_nr} = $docnr;
559 print STDERR "File name: $filename\n";
560 return lc($filename);
567 sub lilypond_element_target_name($$$)
572 # Target is based on node name (or sec name for secs without node attached)
573 my $node_name = main::remove_texi($element->{'node_ref'}->{'texi'});
574 if ($node_name eq '') {
575 $node_name = main::remove_texi($element->{'texi'});
578 # If we have an entry in the section<=>filename map, use that one, otherwise
579 # generate the anchor here.
580 if (exists ($node_to_filename_map->{$node_name})) {
581 (my $filename, $target) = @{$node_to_filename_map->{$node_name}};
583 my $anchor = $node_name;
584 if ($element->{translationof}) {
585 $anchor = main::remove_texi($element->{translationof});
587 # normalize to the same file name as texinfo
588 $target = texinfo_file_name($anchor);
590 # TODO: Once texi2html correctly prints out the target and not the id for
591 # the sections, change this back to ($id, $target)
592 $target = lc($target);
593 return ($target, $target);
597 ## Load the map file for the corrently processed texi file. We do this
598 # using a command init handler, since texi2html does not have any
599 # other hooks that are called after THISDOC is filled but before phase 2
600 # of the texi2html conversion.
601 sub lilypond_init_map ()
603 my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
604 my $map_filename = main::locate_include_file ("${docu_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
605 || main::locate_include_file ("${docu_name}.xref-map");
606 print STDERR "Map filename is: $map_filename\nDocu name is $docu_name\n";
607 $node_to_filename_map = load_map_file ($map_filename);
609 push @Texi2HTML::Config::command_handler_init, \&lilypond_init_map;
613 #############################################################################
614 ### CLEANER LINK TITLE FOR EXTERNAL REFS
615 #############################################################################
617 # The default formatting of external refs returns e.g.
618 # "(lilypond-internals)Timing_translator", so we remove all (...) from the
619 # file_and_node argument. Also, we want only a very simple format, so we don't
620 # even call the default handler!
621 sub lilypond_external_ref($$$$$$)
626 my $file_node = shift;
627 my $href = lc(shift);
628 my $cross_ref = shift;
630 my $displaytext = '';
632 # 1) if we have a cross ref name, that's the text to be displayed:
633 # 2) For the top node, use the (printable) name of the manual, unless we
634 # have an explicit cross ref name
635 # 3) In all other cases use the section name
636 if ($cross_ref ne '') {
637 $displaytext = $cross_ref;
638 } elsif (($section eq '') or ($section eq 'Top')) {
639 $displaytext = $book;
641 $displaytext = $section;
644 $displaytext = &$anchor('', $href, $displaytext) if ($displaytext ne '');
645 return &$I('%{node_file_href}', { 'node_file_href' => $displaytext });
652 #############################################################################
653 ### HANDLING TRANSLATED SECTIONS: handle @translationof, secname<->filename
654 ### map stored on disk, xrefs in other manuals load that map
655 #############################################################################
658 # Try to make use of @translationof to generate files according to the original
659 # English section title...
660 sub lilypond_unknown($$$$$)
668 # the @translationof macro provides the original English section title,
669 # which should be used for file/anchor naming, while the title will be
670 # translated to each language
671 # It is already used by extract_texi_filenames.py, so this should not be
672 # necessary here at all. Still, I'll leave the code in just in case the
673 # python script messed up ;-)
674 if ($pass == 1 and $macro eq "translationof") {
675 if (ref($state->{'element'}) eq 'HASH') {
676 $state->{'element'}->{'translationof'} = main::normalise_space($line);
678 return ('', 1, undef, undef);
680 return &$default_unknown($macro, $line, $pass, $stack, $state);
687 my %translated_books = ();
688 # Construct a href to an external source of information.
689 # node is the node with texinfo @-commands
690 # node_id is the node transliterated and transformed as explained in the
692 # node_xhtml_id is the node transformed such that it is unique and can
693 # be used to make an html cross ref as explained in the texinfo manual
694 # file is the file in '(file)node'
695 sub lilypond_external_href($$$)
699 my $node_hxmlt_id = shift;
702 # 1) Keep a hash of book->section_map
703 # 2) if not file in keys hash => try to load the map (assign empty map if
704 # non-existent => will load only once!)
705 # 3) if node in the section=>(file, anchor) map, replace node_id and
706 # node_xhtml_id by the map's values
707 # 4) call the default_external_href with these values (or the old ones if not found)
709 if (($node_id ne '') and defined($file) and ($node_id ne 'Top')) {
710 my $map_name = $file;
711 $map_name =~ s/-big-page//;
713 # Load the map if we haven't done so already
714 if (!exists($translated_books{$map_name})) {
715 my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
716 my $map_filename = main::locate_include_file ("${map_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
717 || main::locate_include_file ("${map_name}.xref-map");
718 $translated_books{$map_name} = load_map_file ($map_filename);
721 # look up translation. use these values instead of the old filename/anchor
722 my $section_name_map = $translated_books{$map_name};
723 my $node_text = main::remove_texi($node);
724 if (defined($section_name_map->{$node_text})) {
725 ($node_id, $node_hxmlt_id) = @{$section_name_map->{$node_text}};
727 print STDERR "WARNING: Unable to find node '$node_text' in book $map_name.\n";
732 return &$default_external_href($node, $node_id, $node_hxmlt_id, lc($file));
734 return &$default_external_href($node, $node_id, $node_hxmlt_id);
742 #############################################################################
743 ### CUSTOM TOC FOR EACH PAGE (in a frame on the left)
744 #############################################################################
746 my $page_toc_depth = 2;
747 my @default_toc = [];
749 # Initialize the toc_depth to 1 if the command-line option -D=short_toc is given
750 sub lilypond_init_toc_depth ()
752 if (exists($main::value{'short_toc'}) and not exists($main::value{'bigpage'})) {
756 # Set the TOC-depth (depending on a texinfo variable short_toc) in a
757 # command-handler, so we have them available when creating the pages
758 push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth;
761 # recursively generate the TOC entries for the element and its children (which
762 # are only shown up to maxlevel. All ancestors of the current element are also
763 # shown with their immediate children, irrespective of their level.
764 # Unnumbered entries are only printed out if they are at top-level or 2nd level
765 # or their parent element is an ancestor of the currently viewed node.
766 # The conditions to call this method to print the entry for a child node is:
767 # -) the parent is an ancestor of the current page node
768 # -) the parent is a numbered element at top-level toplevel (i.e. show numbered
769 # and unnumbered 2nd-level children of numbered nodes)
770 # -) the child element is a numbered node below level maxlevel
771 sub generate_ly_toc_entries($$$)
774 my $element_path = shift;
778 my $maxlevel = shift;
780 # Skip undefined sections, plus all sections generated by index splitting
781 return() if (not defined($element) or exists($element->{'index_page'}));
783 my $level = $element->{'toc_level'};
784 my $is_parent_of_current = $element->{'id'} && $element_path->{$element->{'id'}};
785 my $ind = ' ' x $level;
788 $this_css_class = " class=\"";
790 $this_css_class = "";
792 $this_css_class .= $is_parent_of_current ? " toc_current" : "";
795 "Learning", "Glossary", "Essay",
796 "Contact", "Tiny examples", "Bug reports"
799 "Features", "Examples", "Freedom", "Background",
800 "Unix", "MacOS X", "Windows",
801 "Notation", "Usage", "Snippets",
802 "Help us", "Development", "Authors"
805 "Productions", "Testimonials",
806 "Source", "Old downloads",
807 "FAQ", "Changes", "Extend", "Internals",
808 "Publications", "Old news"
811 "Text input", "Alternate input",
813 "Translated", "All", "FDL"
816 my $addColor = " colorDefault";
817 foreach $color (@color_1) {
818 if ($element->{'text'} eq $color) {
819 $addColor = " color1";
822 foreach $color (@color_2) {
823 if ($element->{'text'} eq $color) {
824 $addColor = " color2";
827 foreach $color (@color_3) {
828 if ($element->{'text'} eq $color) {
829 $addColor = " color3";
832 foreach $color (@color_4) {
833 if ($element->{'text'} eq $color) {
834 $addColor = " color4";
838 $this_css_class .= $addColor . "\"";
841 my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'target'}",$element->{'text'});
843 push (@result, $entry);
844 my $children = $element->{'section_childs'};
845 if (defined($children) and (ref($children) eq "ARRAY")) {
846 my $force_children = $is_parent_of_current or ($level == 1 and $element->{'number'});
847 my @child_result = ();
848 foreach my $c (@$children) {
849 my $is_numbered_child = defined ($c->{'number'});
850 my $below_maxlevel = $c->{'toc_level'} le $maxlevel;
851 if ($force_children or ($is_numbered_child and $below_maxlevel)) {
852 my @child_res = generate_ly_toc_entries($c, $element_path, $maxlevel);
853 push (@child_result, @child_res);
856 # if no child nodes were generated, e.g. for the index, where expanded pages
857 # are ignored, don't generate a list at all...
859 push (@result, "\n$ind<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
861 push (@result, "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'target'}","(main)"));
863 push (@result, @child_result);
865 push (@result, "$ind</ul>\n");
868 push (@result, "$ind</li>\n");
873 # Print a customized TOC, containing only the first two levels plus the whole
874 # path to the current page
875 sub lilypond_generate_page_toc_body($)
878 my $current_element = $element;
880 $parentelements{$element->{'id'}} = 1;
881 # Find the path to the current element
882 while ( defined($current_element->{'sectionup'}) and
883 ($current_element->{'sectionup'} ne $current_element) )
885 $parentelements{$current_element->{'sectionup'}->{'id'}} = 1
886 if ($current_element->{'sectionup'}->{'id'} ne '');
887 $current_element = $current_element->{'sectionup'};
889 if (exists($main::value{'shallow_toc'})) {
894 return () if not defined($current_element);
895 # Create the toc entries recursively
896 my @toc_entries = "";
898 push (@toc_entries, "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
899 # FIXME: add link to main page, really hackily.
900 if ($element->{'sectionup'}) {
901 # it's not the top element
902 push (@toc_entries, "<li><a href=\"index.html\">Main</a></li>\n");
904 push (@toc_entries, "<li class=\"toc_current\"><a href=\"index.html\">Main</a></li>\n");
907 push (@toc_entries, "<div class=\"contents\">\n");
908 push (@toc_entries, "<ul$NO_BULLET_LIST_ATTRIBUTE>\n");
910 my $children = $current_element->{'section_childs'};
911 foreach ( @$children ) {
912 push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth));
916 # WTF, perl needs 6 lines of magic to do: ' ' + open ('file-name').read ()?
918 my $name = "search-box.html";
919 open FILE, "$ENV{SRC_DIR}/$name" or open FILE, "$ENV{SRC_DIR}/../$name" or die die "no such file: $name: $!";
922 $string = "<li>\n" . $string . "</li>\n";
923 push (@toc_entries, $string);
926 push (@toc_entries, "</ul>\n");
927 push (@toc_entries, "</div>\n");
931 sub lilypond_print_toc_div ($$)
935 my @lines = @$tocref;
936 # use default TOC if no custom lines have been generated
937 @lines = @default_toc if (not @lines);
940 print $fh "\n\n<div id=\"tocframe\">\n";
942 # Remove the leading "GNU LilyPond --- " from the manual title
943 my $topname = $Texi2HTML::NAME{'Top'};
944 $topname =~ s/^GNU LilyPond(:| &[mn]dash;) //;
946 # construct the top-level Docs index (relative path and including language!)
947 my $lang = $Texi2HTML::THISDOC{current_lang};
948 if ($lang and $lang ne "en") {
954 $reldir = "../" if ($Texi2HTML::Config::SPLIT eq 'section');
955 my $uplink = $reldir."web/manuals.${lang}html";
959 print $fh "<p class=\"toc_uplink\"><a href=\"$uplink\"
960 title=\"Documentation Index\"><< " .
961 &ly_get_string ('Back to Documentation Index') .
964 print $fh '<h4 class="toc_header"> ' . &$anchor('',
965 $Texi2HTML::HREF{'Top'},
967 'title="Start of the manual"'
971 foreach my $line (@lines) {
974 print $fh "</div>\n\n";
978 # Create the custom TOC for this page (partially folded, current page is
979 # highlighted) and store it in a global variable. The TOC is written out after
980 # the html contents (but positioned correctly using CSS), so that browsers with
981 # css turned off still show the contents first.
982 our @this_page_toc = ();
983 sub lilypond_print_element_header
985 my $first_in_page = shift;
986 my $previous_is_top = shift;
987 if ($first_in_page and not @this_page_toc) {
988 if (defined($Texi2HTML::THIS_ELEMENT)) {
989 # Create the TOC for this page
990 @this_page_toc = lilypond_generate_page_toc_body($Texi2HTML::THIS_ELEMENT);
993 return &$default_print_element_header( $first_in_page, $previous_is_top);
996 # Generate the HTML output for the TOC
997 sub lilypond_toc_body($)
999 my $elements_list = shift;
1000 # Generate a default TOC for pages without THIS_ELEMENT
1001 @default_toc = lilypond_generate_page_toc_body(@$elements_list[0]);
1002 return &$default_toc_body($elements_list);
1005 # Print out the TOC in a <div> at the beginning of the page
1006 sub lilypond_print_page_head($)
1009 &$default_print_page_head($fh);
1010 print $fh "<div id=\"main\">\n";
1013 # Print out the TOC in a <div> at the end of th page, which will be formatted as a
1014 # sidebar mimicking a TOC frame
1015 sub print_lilypond_page_foot($)
1018 my $program_string = &$program_string();
1019 # print $fh "<p><font size='-1'>$program_string</font><br>$PRE_BODY_CLOSE</p>\n";
1020 print $fh "<!-- FOOTER -->\n\n";
1021 print $fh "<!-- end div#main here -->\n</div>\n\n";
1024 # FIXME: This div and p#languages need to be in div#footer.
1025 # Should we move this div to postprocess_html.py ?
1026 print $fh "<div id=\"verifier_texinfo\">\n";
1027 print $fh "<h3>Validation</h3>\n";
1028 print $fh "<p>Thanks to <a href=\"http://www.webdev.nl/\">webdev.nl</a>";
1029 print $fh " for hosting <code>lilypond.org</code>.\n";
1030 print $fh "<a href=\"http://validator.w3.org/check?uri=referer\">\n";
1031 print $fh "<img src=\"http://www.w3.org/Icons/valid-html401\"\n";
1032 print $fh " alt=\"Valid HTML 4.01 Transitional\"\n";
1033 print $fh " height=\"31\" width=\"88\"></a></p>\n";
1037 # Print the TOC frame and reset the TOC:
1038 lilypond_print_toc_div ($fh, \@this_page_toc);
1039 @this_page_toc = ();
1042 print $fh "</body>\n</html>\n";
1049 #############################################################################
1050 ### NICER / MORE FLEXIBLE NAVIGATION PANELS
1051 #############################################################################
1053 sub get_navigation_text
1056 my $text = $NAVIGATION_TEXT{$button};
1057 if ( ($button eq 'Back') or ($button eq 'FastBack') ) {
1058 $text = $text . $Texi2HTML::NODE{$button} . " ";
1059 } elsif ( ($button eq 'Forward') or ($button eq 'FastForward') ) {
1060 $text = " " . $Texi2HTML::NODE{$button} . $text;
1061 } elsif ( $button eq 'Up' ) {
1062 $text = " ".$text.": " . $Texi2HTML::NODE{$button} . " ";
1068 # Don't automatically create left-aligned table cells for every link, but
1069 # instead create a <td> only on an appropriate '(left|right|center)-aligned-cell-n'
1070 # button text. It's alignment as well as the colspan will be taken from the
1071 # name of the button. Also, add 'newline' button text to create a new table
1072 # row. The texts of the buttons are generated by get_navigation_text and
1073 # will contain the name of the next/previous section/chapter.
1074 sub lilypond_print_navigation
1076 my $buttons = shift;
1077 my $vertical = shift;
1079 my $result = "<table class=\"nav_table\">\n";
1081 $result .= "<tr>" unless $vertical;
1082 my $beginofline = 1;
1083 foreach my $button (@$buttons)
1085 $result .= qq{<tr valign="top" align="left">\n} if $vertical;
1086 # Allow (left|right|center)-aligned-cell and newline as buttons!
1087 if ( $button =~ /^(.*)-aligned-cell-(.*)$/ )
1089 $result .= qq{</td>} unless $beginofline;
1090 $result .= qq{<td valign="middle" align="$1" colspan="$2">};
1093 elsif ( $button eq 'newline' )
1095 $result .= qq{</td>} unless $beginofline;
1096 $result .= qq{</tr>};
1097 $result .= qq{<tr>};
1101 elsif (ref($button) eq 'CODE')
1103 $result .= &$button($vertical);
1105 elsif (ref($button) eq 'SCALAR')
1107 $result .= "$$button" if defined($$button);
1109 elsif (ref($button) eq 'ARRAY')
1111 my $text = $button->[1];
1112 my $button_href = $button->[0];
1113 # verify that $button_href is simple text and text is a reference
1114 if (defined($button_href) and !ref($button_href)
1115 and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
1117 if ($Texi2HTML::HREF{$button_href})
1119 my $anchor_attributes = '';
1120 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button_href})) and ($BUTTONS_ACCESSKEY{$button_href} ne ''))
1122 $anchor_attributes = "accesskey=\"$BUTTONS_ACCESSKEY{$button_href}\"";
1124 if ($USE_REL_REV and (defined($BUTTONS_REL{$button_href})) and ($BUTTONS_REL{$button_href} ne ''))
1126 $anchor_attributes .= " rel=\"$BUTTONS_REL{$button_href}\"";
1130 $Texi2HTML::HREF{$button_href},
1131 get_navigation_text($$text),
1137 $result .= get_navigation_text($$text);
1141 elsif ($button eq ' ')
1142 { # handle space button
1144 ($ICONS && $ACTIVE_ICONS{' '}) ?
1145 &$button_icon_img($BUTTONS_NAME{$button}, $ACTIVE_ICONS{' '}) :
1146 $NAVIGATION_TEXT{' '};
1149 elsif ($Texi2HTML::HREF{$button})
1150 { # button is active
1151 my $btitle = $BUTTONS_GOTO{$button} ?
1152 'title="' . $BUTTONS_GOTO{$button} . '"' : '';
1153 if ($USE_ACCESSKEY and (defined($BUTTONS_ACCESSKEY{$button})) and ($BUTTONS_ACCESSKEY{$button} ne ''))
1155 $btitle .= " accesskey=\"$BUTTONS_ACCESSKEY{$button}\"";
1157 if ($USE_REL_REV and (defined($BUTTONS_REL{$button})) and ($BUTTONS_REL{$button} ne ''))
1159 $btitle .= " rel=\"$BUTTONS_REL{$button}\"";
1161 if ($ICONS && $ACTIVE_ICONS{$button})
1165 $Texi2HTML::HREF{$button},
1166 &$button_icon_img($BUTTONS_NAME{$button},
1167 $ACTIVE_ICONS{$button},
1168 $Texi2HTML::SIMPLE_TEXT{$button}),
1177 $Texi2HTML::HREF{$button},
1178 get_navigation_text($button),
1185 { # button is passive
1187 $ICONS && $PASSIVE_ICONS{$button} ?
1188 &$button_icon_img($BUTTONS_NAME{$button},
1189 $PASSIVE_ICONS{$button},
1190 $Texi2HTML::SIMPLE_TEXT{$button}) :
1192 "[" . get_navigation_text($button) . "]";
1194 $result .= "</td>\n" if $vertical;
1195 $result .= "</tr>\n" if $vertical;
1197 $result .= "</td>" unless $beginofline;
1198 $result .= "</tr>" unless $vertical;
1199 $result .= "</table>\n";
1208 @Texi2HTML::Config::SECTION_BUTTONS =
1209 ('left-aligned-cell-1', 'FastBack',
1210 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
1211 'right-aligned-cell-1', 'FastForward',
1213 'left-aligned-cell-2', 'Back',
1214 'center-aligned-cell-1', 'Up',
1215 'right-aligned-cell-2', 'Forward'
1218 # buttons for misc stuff
1219 @Texi2HTML::Config::MISC_BUTTONS = ('center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About');
1221 # buttons for chapter file footers
1222 # (and headers but only if SECTION_NAVIGATION is false)
1223 @Texi2HTML::Config::CHAPTER_BUTTONS =
1224 ('left-aligned-cell-1', 'FastBack',
1225 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
1226 'right-aligned-cell-1', 'FastForward',
1229 # buttons for section file footers
1230 @Texi2HTML::Config::SECTION_FOOTER_BUTTONS =
1231 ('left-aligned-cell-1', 'FastBack',
1232 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
1233 'right-aligned-cell-1', 'FastForward',
1235 'left-aligned-cell-2', 'Back',
1236 'center-aligned-cell-1', 'Up',
1237 'right-aligned-cell-2', 'Forward'
1240 @Texi2HTML::Config::NODE_FOOTER_BUTTONS =
1241 ('left-aligned-cell-1', 'FastBack',
1242 'center-aligned-cell-3', 'Top', 'Contents', 'Index', 'About',
1243 'right-aligned-cell-1', 'FastForward',
1245 'left-aligned-cell-2', 'Back',
1246 'center-aligned-cell-1', 'Up',
1247 'right-aligned-cell-2', 'Forward'
1254 #############################################################################
1255 ### FOOTNOTE FORMATTING
1256 #############################################################################
1258 # Format footnotes in a nicer way: Instead of printing the number in a separate
1259 # (nr) heading line, use the standard way of prepending <sup>nr</sup> immediately
1260 # before the fn text.
1263 # The following code is copied from texi2html's examples/makeinfo.init and
1264 # should be updated when texi2html makes some changes there!
1266 my $makekinfo_like_footnote_absolute_number = 0;
1268 sub makeinfo_like_foot_line_and_ref($$$$$$$$)
1270 my $foot_num = shift;
1271 my $relative_num = shift;
1274 my $from_file = shift;
1275 my $footnote_file = shift;
1279 $makekinfo_like_footnote_absolute_number++;
1281 # this is a bit obscure, this allows to add an anchor only if formatted
1282 # as part of the document.
1283 $docid = '' if ($state->{'outside_document'} or $state->{'multiple_pass'});
1285 if ($from_file eq $footnote_file)
1287 $from_file = $footnote_file = '';
1290 my $foot_anchor = "<sup>" . &$anchor($docid, "$footnote_file#$footid", $relative_num) . "</sup>";
1291 $foot_anchor = &$anchor($docid, "$footnote_file#$footid", "($relative_num)") if ($state->{'preformatted'});
1293 # unshift @$lines, "<li>";
1294 # push @$lines, "</li>\n";
1295 return ($lines, $foot_anchor);
1298 sub makeinfo_like_foot_lines($)
1301 unshift @$lines, "<hr>\n<h4>$Texi2HTML::I18n::WORDS->{'Footnotes_Title'}</h4>\n";
1302 #<ol type=\"1\">\n";
1303 # push @$lines, "</ol>";
1307 my %makekinfo_like_paragraph_in_footnote_nr;
1309 sub makeinfo_like_paragraph ($$$$$$$$$$$$$)
1314 my $paragraph_command = shift;
1315 my $paragraph_command_formatted = shift;
1316 my $paragraph_number = shift;
1318 my $item_nr = shift;
1319 my $enumerate_style = shift;
1321 my $command_stack_at_end = shift;
1322 my $command_stack_at_begin = shift;
1324 #print STDERR "format: $format\n" if (defined($format));
1325 #print STDERR "paragraph @$command_stack_at_end; @$command_stack_at_begin\n";
1326 $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
1327 exists($special_list_commands{$format}->{$paragraph_command}));
1328 return '' if ($text =~ /^\s*$/);
1329 foreach my $style(t2h_collect_styles($command_stack_at_begin))
1331 $text = t2h_begin_style($style, $text);
1333 foreach my $style(t2h_collect_styles($command_stack_at_end))
1335 $text = t2h_end_style($style, $text);
1337 if (defined($paragraph_number) and defined($$paragraph_number))
1339 $$paragraph_number++;
1340 return $text if (($format eq 'itemize' or $format eq 'enumerate') and
1341 ($$paragraph_number == 1));
1346 $open .= " align=\"$paragraph_style{$align}\"";
1348 my $footnote_text = '';
1349 if (defined($command_stack_at_begin->[0]) and $command_stack_at_begin->[0] eq 'footnote')
1351 my $state = $Texi2HTML::THISDOC{'state'};
1352 $makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number}++;
1353 if ($makekinfo_like_paragraph_in_footnote_nr{$makekinfo_like_footnote_absolute_number} <= 1)
1355 $open.=' class="footnote"';
1356 my $document_file = $state->{'footnote_document_file'};
1357 if ($document_file eq $state->{'footnote_footnote_file'})
1359 $document_file = '';
1361 my $docid = $state->{'footnote_place_id'};
1362 my $doc_state = $state->{'footnote_document_state'};
1363 $docid = '' if ($doc_state->{'outside_document'} or $doc_state->{'multiple_pass'});
1364 my $foot_label = &$anchor($state->{'footnote_footnote_id'},
1365 $document_file . "#$state->{'footnote_place_id'}",
1366 "$state->{'footnote_number_in_page'}");
1367 $footnote_text = "<small>[${foot_label}]</small> ";
1370 return $open.'>'.$footnote_text.$text.'</p>';
1374 #############################################################################
1376 #############################################################################
1378 # For split pages, use index.html as start page!
1379 if ($Texi2HTML::Config::SPLIT eq 'section') {
1380 $Texi2HTML::Config::TOP_FILE = 'index.html';
1384 push @Texi2HTML::Config::command_handler_process, \&lilypond_init_toc_depth;