summaryrefslogtreecommitdiff
path: root/Build/source/utils/texi2html/examples/book.init
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/texi2html/examples/book.init')
-rw-r--r--Build/source/utils/texi2html/examples/book.init197
1 files changed, 197 insertions, 0 deletions
diff --git a/Build/source/utils/texi2html/examples/book.init b/Build/source/utils/texi2html/examples/book.init
new file mode 100644
index 00000000000..a4147a38305
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/book.init
@@ -0,0 +1,197 @@
+# This is based on the scriptbasic style
+
+$DO_CONTENTS = 1;
+
+@SECTION_BUTTONS =
+ (
+ 'Back', 'Forward', ' ', 'Contents', 'Index', 'About'
+ );
+
+@CHAPTER_BUTTONS =
+ (
+ 'Back', 'Forward', ' ', 'Contents', 'Index', 'About'
+ );
+
+@MISC_BUTTONS = ('Contents', 'Index', 'About');
+
+@SECTION_FOOTER_BUTTONS = ('Contents', 'Index', 'About');
+
+@NODE_FOOTER_BUTTONS = ('Back', 'Forward');
+
+$WORDS_IN_PAGE = undef;
+$SHOW_MENU = 0;
+
+$BIG_RULE = '<hr size="2">';
+
+sub print_sub_toc($$);
+
+sub print_sub_toc($$)
+{
+ my $parent_element = shift;
+ my $element = shift;
+ my $result = &$anchor('', main::href($element, $parent_element->{'file'}), $element->{'text'}) . " <br>\n";
+#print STDERR "SUB_TOC $element->{'text'}\n"; #sleep 1;
+ if (exists($element->{'child'}))
+ {
+#print STDERR "SUB_TOC child $element->{'child'}->{'text'}\n";
+ $result .= "<ul>\n". print_sub_toc($parent_element, $element->{'child'}) ."</ul>\n";
+ }
+ if (exists($element->{'next'}))
+ {
+#print STDERR "SUB_TOC next($element->{'text'}) $element->{'next'}->{'text'}\n";
+ $result .= print_sub_toc($parent_element, $element->{'next'});
+ }
+ return $result;
+}
+
+sub print_up_toc($$)
+{
+ my $fh = shift;
+ my $element = shift;
+ my $current_element = $element;
+ my @elements;
+ while (defined($current_element->{'up'}) and ($current_element->{'up'} ne $current_element))
+ {
+ unshift (@elements, $current_element->{'up'});
+ $current_element = $current_element->{'up'};
+ }
+ #print $fh "<ul>" . &$anchor('', $Texi2HTML::HREF{Contents}, '[' . $Texi2HTML::NAME{Contents} . ']') . " <br>\n";
+ foreach my $elem (@elements)
+ {
+ print $fh "<ul>" . &$anchor('', main::href($elem, $element->{'file'}), $elem->{'text'}) . " <br>\n";
+ }
+ foreach my $elem (@elements)
+ {
+ print $fh "</ul>\n";
+ }
+ print $fh "</ul>\n";
+}
+
+$print_section = \&book_print_section;
+$print_Top = \&book_print_Top;
+$print_Toc = \&book_print_Toc;
+$element_file_name = \&book_element_file_name;
+
+sub book_print_section($$$)
+{
+ my $fh = shift;
+ my $first_in_page = shift;
+ my $previous_is_top = shift;
+ my $buttons = \@SECTION_BUTTONS;
+
+ if ($first_in_page and $SECTION_NAVIGATION)
+ {
+ #print_up_toc($fh, $Texi2HTML::THIS_ELEMENT) if ($SPLIT eq 'node');
+ print_up_toc($fh, $Texi2HTML::THIS_ELEMENT);
+ &$print_head_navigation($fh, $buttons);
+ }
+ else
+ { # got to do this here, as it isn't done in print_head_navigation
+ main::print_lines($fh, $Texi2HTML::THIS_HEADER);
+ &$print_navigation($fh, $buttons) if ($SECTION_NAVIGATION);
+ }
+ my $nw = main::print_lines($fh);
+ if (defined $SPLIT
+ and (($SPLIT eq 'node') && $SECTION_NAVIGATION))
+ {
+ &$print_foot_navigation($fh);
+ print $fh "$SMALL_RULE\n";
+ &$print_navigation($fh, \@NODE_FOOTER_BUTTONS) if (!defined($WORDS_IN_PAGE) or (defined ($nw)
+ and $nw >= $WORDS_IN_PAGE));
+ }
+}
+
+sub book_print_Top($$)
+{
+ my $fh = shift;
+ my $has_top_heading = shift;
+
+ my $buttons = \@MISC_BUTTONS;
+ &$print_head_navigation($fh, $buttons);
+ print $fh $Texi2HTML::TITLEPAGE;
+ print $fh "<h1 class=\"settitle\">$Texi2HTML::NAME{Top}</h1>\n"
+ unless ($has_top_heading);
+ main::print_lines($fh, $Texi2HTML::THIS_SECTION);
+ print $fh '<h2> ' . $Texi2HTML::NAME{'Contents'} . "</h2>\n" ;
+ main::print_lines($fh, $Texi2HTML::TOC_LINES);
+}
+
+sub book_print_Toc
+{
+ my $fh = shift;
+ &$print_page_head($fh) if $SPLIT;
+ #print $fh $Texi2HTML::TITLEPAGE;
+ print $fh '<h2> ' . $Texi2HTML::NAME{'Contents'} . "</h2>\n" ;
+ main::print_lines($fh);
+ &$print_misc_footer($fh, \@MISC_BUTTONS);
+}
+
+my $unumbered_nr = -1;
+my $previous_nr;
+my $previous_file_name;
+
+sub book_element_file_name($$$)
+{
+ my $element = shift;
+ my $is_top = shift;
+ my $prefix = shift;
+
+ if (defined($previous_nr) and ($element->{'doc_nr'} == $previous_nr))
+ {
+ return $previous_file_name;
+ }
+ if ($is_top)
+ {
+ $previous_file_name = "${prefix}_top.html";
+ }
+ elsif (defined($element->{'number'}) and ($element->{'number'} ne ''))
+ {
+ my $number = $element->{'number'};
+ $number .= '.' unless ($number =~ /\.$/);
+ $previous_file_name = "${prefix}_$number" . 'html';
+ }
+ else
+ {
+ $unumbered_nr++;
+ $previous_file_name = "${prefix}_U." . $unumbered_nr . '.html';
+ }
+ $previous_nr = $element->{'doc_nr'};
+ return $previous_file_name;
+}
+
+$heading = \&book_heading;
+
+sub book_heading($)
+{
+ my $element = shift;
+ my $level = 3;
+ if (!$element->{'node'})
+ {
+ $level = $element->{'level'};
+ }
+ $level = 1 if ($level == 0);
+ my $text = $element->{'text'};
+ if (!$element->{'node'} and (!$NUMBER_SECTIONS))
+ {
+ $text = $element->{'name'};
+ }
+ return '' if ($text !~ /\S/);
+ my $class = $element->{'tag_level'};
+ $class = 'unnumbered' if ($class eq 'top');
+ if (defined($element->{'tocid'}) and $TOC_LINKS)
+ {
+ $text = &$anchor ('', "$Texi2HTML::THISDOC{'toc_file'}#$element->{'tocid'}", $text);
+ }
+ $text = "<h$level class=\"$class\"> $text </h$level>\n";
+ #if (defined($SPLIT) and ($SPLIT eq 'node')
+ if (exists($element->{'child'})
+ and ($element->{'tag_level'} !~ /heading/))
+ {
+ $text .= "<ul>\n";
+ $text .= "" . print_sub_toc($element, $element->{'child'});
+ $text .= "</ul>\n";
+ }
+ return $text;
+}
+
+1;