summaryrefslogtreecommitdiff
path: root/Build/source/utils/texi2html/examples
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:16:42 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:16:42 +0000
commita3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (patch)
treef4a8a34f904c1bb86adcc3ae0e14434badc6dbe4 /Build/source/utils/texi2html/examples
parent6c0eafbb1395d426a72a74538e0b2a95e8344ca6 (diff)
utils 1
git-svn-id: svn://tug.org/texlive/trunk@1484 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/texi2html/examples')
-rw-r--r--Build/source/utils/texi2html/examples/book.init197
-rw-r--r--Build/source/utils/texi2html/examples/chm.init366
-rw-r--r--Build/source/utils/texi2html/examples/html32.init205
-rw-r--r--Build/source/utils/texi2html/examples/inlinestyle.init39
-rw-r--r--Build/source/utils/texi2html/examples/makeinfo.init147
-rw-r--r--Build/source/utils/texi2html/examples/noheaders.init137
-rw-r--r--Build/source/utils/texi2html/examples/roff.init1165
-rw-r--r--Build/source/utils/texi2html/examples/utf8.init27
-rw-r--r--Build/source/utils/texi2html/examples/xhtml.init188
9 files changed, 2471 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;
diff --git a/Build/source/utils/texi2html/examples/chm.init b/Build/source/utils/texi2html/examples/chm.init
new file mode 100644
index 00000000000..a809ec87704
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/chm.init
@@ -0,0 +1,366 @@
+# -*-perl-*-
+
+main::load_init_file('', 'noheaders.init');
+
+$SHOW_MENU = 0;
+$SPLIT = 'node';
+$DO_CONTENT = 1;
+$SPLIT_INDEX = undef;
+$IDX_SUMMARY = 1;
+
+$SMALL_RULE = '';
+$DEFAULT_RULE = '';
+$MIDDLE_RULE = '';
+$BIG_RULE = '';
+
+$DOCUMENT_DESCRIPTION = '';
+$SEPARATED_FOOTNOTES = 0;
+
+$index_summary_file_entry = \&chm_index_summary_file_entry;
+$index_summary_file_begin = \&chm_index_summary_file_begin;
+$index_summary_file_end = \&chm_index_summary_file_end;
+
+$print_page_foot = \&chm_print_page_foot;
+
+my $default_toc_body = $toc_body;
+$toc_body = \&chm_toc_body;
+
+$finish_out = \&chm_finish_out;
+my $default_init_out = $init_out;
+
+$init_out = \&chm_init_out;
+
+my %chm_languages = (
+ 'en' => '0x409 English (United States)',
+ 'sq' => '0x041c Albanian',
+# 'ar' => '0x1401 Arabic (ALGERIA)',
+# 'es' => '0x2c0a Spanish (ARGENTINA)',
+# 'en' => '0x0c09 English (AUSTRALIA)',
+# 'de' => '0x0c07 German (AUSTRIA)',
+# 'ar' => '0x3c01 Arabic (BAHRAIN)',
+ 'be' => '0x0423 Byelorussian',
+# 'fr' => '0x080c French (BELGIUM)',
+# 'en' => '0x2809 English (BELIZE)',
+# 'es' => '0x400a Spanish (BOLIVIA)',
+# 'pt' => '0x0416 Portuguese (BRAZIL)',
+# 'ms' => '0x083e Malay (BRUNEI DARUSSALAM)',
+ 'bg' => '0x0402 Bulgarian',
+# 'fr' => '0x0c0c French (CANADA)',
+# 'es' => '0x340a Spanish (CHILE)',
+ 'zh' => '0x0804 Chinese (CHINA)',
+# 'es' => '0x240a Spanish (COLOMBIA)',
+# 'es' => '0x140a Spanish (COSTA RICA)',
+ 'hr' => '0x041a Croatian',
+ 'cs' => '0x0405 Czech',
+ 'da' => '0x0406 Danish',
+# 'es' => '0x1c0a Spanish (DOMINICAN REPUBLIC)',
+# 'es' => '0x300a Spanish (ECUADOR)',
+# 'ar' => '0x0c01 Arabic (EGYPT)',
+# 'es' => '0x440a Spanish (EL SALVADOR)',
+ 'et' => '0x0425 Estonian',
+ 'fo' => '0x0438 Faeroese',
+ 'fi' => '0x040b Finnish',
+ 'fr' => '0x040c French (FRANCE)',
+ 'de' => '0x0407 German (GERMANY)',
+ 'el' => '0x0408 Greek',
+# 'es' => '0x100a Spanish (GUATEMALA)',
+# 'es' => '0x480a Spanish (HONDURAS)',
+# 'zh' => '0x0c04 Chinese (HONG KONG)',
+ 'hu' => '0x040e Hungarian',
+ 'is' => '0x040f Icelandic',
+ 'hi' => '0x0439 Hindi',
+ 'in' => '0x04',
+ 'fa' => '0x0429 Farsi',
+# 'ar' => '0x0801 Arabic (IRAQ)',
+# 'en' => '0x1809 English (IRELAND)',
+ 'iw' => '0x04',
+ 'it' => '0x0410 Italian',
+# 'en' => '0x2009 English (JAMAICA)',
+ 'ja' => '0x0411 Japanese',
+# 'ar' => '0x2c01 Arabic (JORDAN)',
+ 'sw' => '0x0441 Swahili',
+ 'ko' => '0x0412 Korean',
+# 'ar' => '0x3401 Arabic (KUWAIT)',
+ 'al' => '0x0426 Latvian (Lettish)',
+# 'ar' => '0x3001 Arabic (LEBANON)',
+# 'ar' => '0x1001 Arabic (LIBYAN ARAB JAMAHIRIYA)',
+# 'de' => '0x1407 German (LIECHTENSTEIN)',
+ 'lt' => '0x0427 Lithuanian',
+# 'de' => '0x1007 German (LUXEMBOURG)',
+# 'zh' => '0x1404 Chinese (MACAU)',
+ 'mk' => '0x042f Macedonian',
+# 'ms' => '0x043e Malay (MALAYSIA)',
+# 'es' => '0x080a Spanish (MEXICO)',
+# 'fr' => '0x180c French (MONACO)',
+# 'ar' => '0x1801 Arabic (MOROCCO)',
+ 'nl' => '0x0413 Dutch',
+# 'en' => '0x1409 English (NEW ZEALAND)',
+# 'es' => '0x4c0a Spanish (NICARAGUA)',
+ 'no' => '0x0414 Norwegian',
+# 'ar' => '0x2001 Arabic (OMAN)',
+ 'ur' => '0x0420 Urdu',
+# 'es' => '0x180a Spanish (PANAMA)',
+# 'es' => '0x3c0a Spanish (PARAGUAY)',
+# 'es' => '0x280a Spanish (PERU)',
+# 'en' => '0x3409 English (PHILIPPINES)',
+ 'pl' => '0x0415 Polish',
+ 'pt' => '0x0816 Portuguese (PORTUGAL)',
+# 'es' => '0x500a Spanish (PUERTO RICO)',
+# 'ar' => '0x4001 Arabic (QATAR)',
+ 'ro' => '0x0418 Romanian',
+ 'ru' => '0x0419 Russian',
+ 'ar' => '0x0401 Arabic (SAUDI ARABIA)',
+# 'zh' => '0x1004 Chinese (SINGAPORE)',
+ 'sk' => '0x041b Slovak',
+ 'sl' => '0x0424 Slovenian',
+ 'af' => '0x0436 Afrikaans',
+ 'ca' => '0x0403 Catalan',
+ 'sv' => '0x041d Swedish',
+# 'de' => '0x0807 German (SWITZERLAND)',
+# 'ar' => '0x2801 Arabic (SYRIAN ARAB REPUBLIC)',
+# 'zh' => '0x0404 Chinese (TAIWAN, PROVINCE OF CHINA)',
+ 'th' => '0x041e Thai',
+# 'en' => '0x2c09 English (TRINIDAD AND TOBAGO)',
+# 'ar' => '0x1c01 Arabic (TUNISIA)',
+ 'tr' => '0x041f Turkish',
+ 'uk' => '0x0422 Ukrainian',
+# 'ar' => '0x3801 Arabic (UNITED ARAB EMIRATES)',
+# 'en' => '0x0809 English (UNITED KINGDOM)',
+# 'en' => '0x0409 English (UNITED STATES)',
+# 'es' => '0x380a Spanish (URUGUAY)',
+# 'es' => '0x200a Spanish (VENEZUELA)',
+ 'vi' => '0x242a Vietnamese',
+# 'ar' => '0x2401 Arabic (YEMEN)',
+# 'en' => '0x3009 English (ZIMBABWE)',
+ #'' => '',
+);
+
+my %hhk_global_property = (
+ 'ImageType' => 'Folder',
+);
+
+my %hhc_global_property = (
+ 'ImageType' => 'Folder',
+);
+
+# We prepare a environment for conversion of texi to unicode (maybe this
+# could be in utf8.init ?)
+my %chm_texi_map = %texi_map;
+my %chm_simple_map_texi = %simple_map_texi;
+my %chm_style_map_texi = ();
+
+foreach my $command (keys(%style_map_texi))
+{
+ $chm_style_map_texi{$command} = {};
+ foreach my $key (keys (%{$style_map_texi{$command}}))
+ {
+#print STDERR "$command, $key, $style_map_texi{$command}->{$key}\n";
+ $chm_style_map_texi{$command}->{$key} =
+ $style_map_texi{$command}->{$key};
+ }
+}
+
+foreach my $key (keys(%unicode_accents))
+{
+ $chm_style_map_texi{$key}->{'function'} = \&t2h_utf8_accent;
+}
+
+foreach my $key (%things_map)
+{
+ if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
+ {
+ $chm_texi_map{$key} = chr(hex($unicode_map{$key}));
+ }
+}
+
+$chm_simple_map_texi{"\n"} = ' ';
+
+my $hhp_lines = '';
+
+sub chm_init_out()
+{
+ my $encoding = &$default_init_out();
+ $TOC_FILE = $Texi2HTML::THISDOC{'file_base_name'}.'.hhc';
+ my $hhk_file = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}" . ".hhk";
+ open(IDXFILE, ">:encoding(utf8)", $hhk_file)
+ || die "Can't open $file_name for writing: $!\n";
+ print "# writing HTML Help index in $hhk_file...\n" if $VERBOSE;
+ print IDXFILE "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n<HTML>\n";
+ print IDXFILE "<HEAD>\n<meta name=\"GENERATOR\" content=\"$Texi2HTML::THISDOC{program}\">\n";
+ print IDXFILE "<!-- Sitemap 1.0 -->\n</HEAD>\n<BODY>\n";
+ print IDXFILE "<OBJECT type=\"text/site properties\">\n";
+ foreach my $property (keys(%hhk_global_property))
+ {
+ print IDXFILE "<param name=\"$property\" value=\"$hhk_global_property{$property}\">\n";
+
+ }
+ print IDXFILE "</OBJECT>\n";
+
+ my $hhp_file = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}.hhp";
+ print "# writing HTML Help project in $hhp_file...\n" if $VERBOSE;
+ open (HHPFILE, ">:encoding(utf8)", $hhp_file) or
+ die "Can't open $hhp_file for writing: $!\n";
+ my $language = $chm_languages{'en'};
+ if (exists ($chm_languages{$LANG}))
+ {
+ $language = $chm_languages{$LANG};
+ }
+ my $title = to_utf8($Texi2HTML::THISDOC{'title_texi'});
+
+ print HHPFILE <<EOT;
+[OPTIONS]
+Compatibility=1.1 or later
+Compiled file=$Texi2HTML::THISDOC{'file_base_name'}.chm
+Contents file=$Texi2HTML::THISDOC{'file_base_name'}.hhc
+Default Window=Default
+Default topic=$TOP_FILE
+Display compile progress=No
+Full-text search=Yes
+Index file=$Texi2HTML::THISDOC{'file_base_name'}.hhk
+Language=$language
+Title=$title
+
+[WINDOWS]
+Default=,"$Texi2HTML::THISDOC{'file_base_name'}.hhc","$Texi2HTML::THISDOC{'file_base_name'}.hhk","$TOP_FILE","$TOP_FILE",,,,,0x22520,,0x384e,,,,,,,,0
+
+[FILES]
+EOT
+ return $encoding;
+}
+sub chm_print_page_foot($)
+{
+ my $fh = shift;
+ print $fh <<EOT;
+<p>
+$PRE_BODY_CLOSE
+</p>
+</body>
+</html>
+EOT
+}
+
+# Convert texi to string with utf8
+sub to_utf8($)
+{
+ my $text = shift;
+ $main::simple_map_texi_ref = \%chm_simple_map_texi;
+ $main::style_map_texi_ref = \%chm_style_map_texi;
+ $main::texi_map_ref = \%chm_texi_map;
+ my $normal_text_kept = $normal_text;
+ $Texi2HTML::Config::normal_text = \&t2h_utf8_normal_text;
+
+ $text = main::remove_texi($text);
+
+ $normal_text = $normal_text_kept;
+ $main::simple_map_texi_ref = \%simple_map_texi;
+ $style_map_texi_ref = \%style_map_texi;
+ $main::texi_map_ref = \%texi_map;
+ return $text;
+}
+
+
+my @hhc_lines;
+my %chm_files;
+
+sub chm_toc_body($)
+{
+ my $elements_ref = shift;
+ &$default_toc_body($elements_ref);
+ my $level = 0;
+ foreach my $element (@$elements_ref)
+ {
+ while ($level != $element->{'toc_level'})
+ {
+ if ($level < $element->{'toc_level'})
+ {
+ push (@hhc_lines, "<UL>\n");
+ $level++;
+ }
+ elsif ($level > $element->{'toc_level'})
+ {
+ push (@hhc_lines, "</UL>\n");
+ $level--;
+ }
+ }
+ my $text = '';
+ if ($NUMBER_SECTIONS)
+ {
+ $text .= $element->{'number'} . " ";
+
+ }
+ $text .= to_utf8($element->{'texi'});
+ $text =~ s/^\s*//;
+ push (@hhc_lines, "<LI> <OBJECT type=\"text/sitemap\">\n<param name=\"Name\" value=\"$text\">\n<param name=\"Local\" value=\"$element->{'file'}#$element->{'id'}\">\n</OBJECT> </LI>\n");
+ if (!$chm_files{$element->{'file'}})
+ {
+ $hhp_lines .= "$element->{'file'}\n";
+ $chm_files{$element->{'file'}} = 1;
+ }
+ }
+ while ($level > 0)
+ {
+ push (@hhc_lines, "</UL>\n");
+ $level--;
+ }
+}
+
+# key:
+# origin_href:
+# entry:
+# texi entry:
+# element_href:
+# element_text:
+sub chm_index_summary_file_entry ($$$$$$$$)
+{
+ my $name = shift;
+ my $key = shift;
+ my $origin_href = shift;
+ my $entry = shift;
+ my $text = '';
+ #$entry = &$protect_text($key);
+ my $texi_entry = shift;
+ my $element_href = shift;
+ my $element_text = shift;
+ my $is_printed = shift;
+ $entry = to_utf8($texi_entry);
+ print IDXFILE "<LI> <OBJECT type=\"text/sitemap\">\n<param name=\"Name\" value=\"$entry\">\n<param name=\"Local\" value=\"$origin_href\">\n</OBJECT> </LI>\n";
+}
+
+sub chm_index_summary_file_begin($$)
+{
+ my $name = shift;
+ my $is_printed = shift;
+}
+
+# file is not closed here but in finish_out.
+sub chm_index_summary_file_end($$)
+{
+ my $name = shift;
+ my $is_printed = shift;
+}
+
+sub chm_finish_out()
+{
+ print IDXFILE "</BODY>\n</HTML>\n";
+ close (IDXFILE);
+ my $hhc_file = "$Texi2HTML::THISDOC{'destination_directory'}$Texi2HTML::THISDOC{'file_base_name'}.hhc";
+ open (HHCFILE, ">:encoding(utf8)", $hhc_file) or
+ die "Can't open $hhc_file for writing: $!\n";
+
+ print HHCFILE "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n<HTML>\n";
+ print HHCFILE "<HEAD>\n<meta name=\"GENERATOR\" content=\"$Texi2HTML::THISDOC{program}\">\n";
+ print HHCFILE "<!-- Sitemap 1.0 -->\n</HEAD>\n<BODY>\n";
+ print HHCFILE "<OBJECT type=\"text/site properties\">\n";
+ foreach my $property (keys(%hhc_global_property))
+ {
+ print HHCFILE "<param name=\"$property\" value=\"$hhc_global_property{$property}\">\n";
+
+ }
+ print HHCFILE "</OBJECT>\n";
+ main::print_lines(\*HHCFILE, \@hhc_lines);
+ print HHCFILE "</HTML>\n</BODY>\n";
+ print HHPFILE $hhp_lines;
+ close (HHPFILE);
+}
+
+1;
diff --git a/Build/source/utils/texi2html/examples/html32.init b/Build/source/utils/texi2html/examples/html32.init
new file mode 100644
index 00000000000..4e69eafd7d8
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/html32.init
@@ -0,0 +1,205 @@
+# -*-perl-*-
+# APA: Add SystemLiteral to identify the canonical DTD.
+# [Definition:] The SystemLiteral is called the entity's system
+# identifier. It is a URI, which may be used to retrieve the entity.
+# See http://www.xml.com/axml/target.html#NT-ExternalID
+$DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN" "http://www.w3.org/TR/html32/loose.dtd">';
+
+$FRAMESET_DOCTYPE = $DOCTYPE;
+
+$BODYTEXT = 'bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"';
+# this controls the pre style for menus
+$MENU_PRE_STYLE = '';
+
+$TOC_LIST_STYLE ='';
+
+$USE_ISO = 0;
+$MENU_SYMBOL = '*';
+
+# This lines are inserted before and after the shortcontents
+$BEFORE_OVERVIEW = "";
+$AFTER_OVERVIEW = '';
+
+# This lines are inserted before and after the contents
+$BEFORE_TOC_LINES = "";
+$AFTER_TOC_LINES = '';
+
+# html version for latex2html
+$L2H_HTML_VERSION = "3.2";
+
+# no css
+$CSS_LINES = "";
+%css_map = ();
+
+$things_map{'oe'} = '&#156;';
+$things_map{'OE'} = '&#140;';
+$things_map{'dots'} = '<small>...</small>';
+$things_map{'enddots'} = '<small>....</small>';
+$things_map{'euro'} = 'Euro';
+$style_map{'sansserif'} = {};
+
+# formatting functions
+
+$summary_letter = \&t2h_html32_summary_letter;
+$protect_text = \&t2h_html32_protect_text;
+$heading = \&t2h_html32_heading;
+$preformatted = \&t2h_html32_preformatted;
+$raw = \&t2h_html32_raw;
+$menu = \&t2h_html32_menu;
+$foot_section = \&t2h_html32_foot_section;
+$cartouche = \&t2h_html32_cartouche;
+$listoffloats = \&t2h_html32_listoffloats;
+$float = \&t2h_html32_float;
+
+# &quot; is not in html 3.2
+sub t2h_html32_protect_text($)
+{
+ my $text = shift;
+ $text =~ s/&/&amp;/g;
+ $text =~ s/</&lt;/g;
+ $text =~ s/>/&gt;/g;
+ #$text =~ s/\"/&quot;/g;
+ return $text;
+}
+
+# a preformatted section
+sub t2h_html32_preformatted($$$)
+{
+ my $text = shift;
+ my $pre_style = shift;
+ my $class = shift;
+
+ return '' if ($text eq '');
+ return "<pre>$text</pre>";
+}
+
+# a heading for an element
+sub t2h_html32_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/);
+ if (defined($element->{'tocid'}) and $TOC_LINKS)
+ {
+ $text = &$anchor ('', "$Texi2HTML::THISDOC{'toc_file'}#$element->{'tocid'}", $text);
+ }
+ return "<h$level> $text </h$level>\n";
+}
+
+# formatting of raw regions
+# ih L2H is true another mechanism is used for tex
+sub t2h_html32_raw($$)
+{
+ my $style = shift;
+ my $text = shift;
+ if ($style eq 'verbatim' or $style eq 'tex')
+ {
+ return "<pre>" . &$protect_text($text) . '</pre>';
+ }
+ elsif ($style eq 'html')
+ {
+ return $text;
+ }
+ else
+ {
+ warn "$WARN (bug) unknown style $style\n";
+ return &$protect_text($text);
+ }
+}
+
+# a whole menu
+sub t2h_html32_menu($)
+{
+ my $text = shift;
+ if ($text =~ /\S/)
+ {
+ return "<table border=\"0\" cellspacing=\"0\">\n"
+ . $text . "</table>\n";
+ }
+}
+
+# a simple menu entry ref in case we aren't in a standard menu context
+sub t2h_html32_foot_section($)
+{
+ my $lines = shift;
+ unshift (@$lines, "<hr>\n", "<h3>Footnotes</h3>\n");
+ return $lines;
+}
+
+# a cartouche
+sub t2h_html32_cartouche($)
+{
+ my $text = shift;
+
+ if ($text =~ /\S/)
+ {
+ return "<table border=\"1\"><tr><td>\n" . $text . "</td></tr></table>\n";
+ }
+ return '';
+}
+
+
+# no style
+sub t2h_html32_summary_letter($$$)
+{
+ my $letter = shift;
+ my $file = shift;
+ my $identifier = shift;
+ return &$anchor('', $file . '#' . $identifier, '<b>' . &$protect_text($letter) . '</b>');
+}
+
+sub t2h_html32_float($$$$$)
+{
+ my $text = shift;
+ my $float = shift;
+ my $caption = shift;
+ my $shortcaption = shift;
+
+ my $label = '';
+ if (exists($float->{'id'}))
+ {
+ $label = &$anchor($float->{'id'});
+ }
+ my $caption_text = '';
+
+ if (defined($float->{'caption_texi'}))
+ {
+ $caption_text = $caption;
+ }
+ elsif (defined($float->{'shortcaption_texi'}))
+ {
+ $caption_text = $shortcaption;
+ }
+ elsif (defined($caption))
+ {
+ $caption_text = $caption;
+ }
+
+ return "$label\n" . $text . $caption_text;
+}
+
+sub t2h_html32_listoffloats($$$)
+{
+ my $style_texi = shift;
+ my $style = shift;
+ my $float_entries = shift;
+
+ my $result = "<dl>\n" ;
+ foreach my $float_entry (@$float_entries)
+ {
+ $result .= $float_entry;
+ }
+ return $result . "</dl>\n";
+}
+
+
diff --git a/Build/source/utils/texi2html/examples/inlinestyle.init b/Build/source/utils/texi2html/examples/inlinestyle.init
new file mode 100644
index 00000000000..ecd8c63e4fb
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/inlinestyle.init
@@ -0,0 +1,39 @@
+
+$TOC_LIST_ATTRIBUTE = $TOC_LIST_ATTRIBUTE . " style=\"$TOC_LIST_STYLE\"";
+
+# we empty CSS_LINES as all styles are inlined
+$CSS_LINES = "";
+
+$style_map{'sansserif'} =
+ { 'attribute' => "span style=\"$css_map{'sansserif'}\""};
+
+# formatting functions
+
+$preformatted = \&t2h_inlinestyle_preformatted;
+$summary_letter = \&t2h_inline_summary_letter;
+
+sub t2h_inlinestyle_preformatted($$$)
+{
+ my $text = shift;
+ my $pre_style = shift;
+ my $class = shift;
+
+ return '' if ($text eq '');
+ my $open = '<pre';
+ if ($pre_style)
+ {
+ $open .= " style=\"$pre_style\"";
+ }
+ return $open .= " class=\"$class\">$text</pre>";
+}
+
+sub t2h_inline_summary_letter($$$)
+{
+ my $letter = shift;
+ my $file = shift;
+ my $identifier = shift;
+ return &$anchor('', $file . '#' . $identifier, '<b>' . &$protect_html($letter) . '</b>', 'class="summary-letter" style="text-decoration: none"');
+
+}
+
+1;
diff --git a/Build/source/utils/texi2html/examples/makeinfo.init b/Build/source/utils/texi2html/examples/makeinfo.init
new file mode 100644
index 00000000000..ec3cb92264f
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/makeinfo.init
@@ -0,0 +1,147 @@
+# -*-perl-*-
+$TOP_FILE = 'index.html';
+
+$SHOW_MENU = 1;
+
+$USE_NODES = 1;
+
+$SPLIT = 'node';
+
+$SECTION_NAVIGATION = 1;
+
+$SHORT_REF = 1;
+
+$NODE_NAME_IN_MENU = 1;
+
+$AVOID_MENU_REDUNDANCY = 0;
+
+$SPLIT_INDEX = 0;
+
+$MENU_SYMBOL = '*';
+
+$WORDS_IN_PAGE = 200;
+
+$SEPARATED_FOOTNOTES = 0;
+
+@SECTION_BUTTONS =
+ (
+ \"node: ", \$Texi2HTML::NODE{This}, [ 'NodeNext', \$Texi2HTML::NODE{Next} ] , \",", [ 'NodePrev', \$Texi2HTML::NODE{Prev} ], \",", [ 'NodeUp', \$Texi2HTML::NODE{NodeUp} ], 'Following'
+ );
+
+my $default_init_out = $init_out;
+$init_out = \&makeinfo_like_init_out;
+
+sub makeinfo_like_init_out()
+{
+ my $encoding = &$default_init_out();
+ $NAVIGATION_TEXT{'Following'} = ' &gt; ';
+ return $encoding;
+}
+
+
+@MISC_BUTTONS = @SECTION_BUTTONS;
+
+$foot_line_and_ref = \&makeinfo_like_foot_line_and_ref;
+$foot_lines = \&makeinfo_like_foot_lines;
+$index_summary = \&makeinfo_like_index_summary;
+$summary_letter = \&makeinfo_like_summary_letter;
+$index_entry = \&makeinfo_like_index_entry;
+$index_letter = \&makeinfo_like_index_letter;
+$print_index = \&makeinfo_like_print_index;
+$listoffloats = \&makeinfo_like_listoffloats;
+$listoffloats_entry = \&makeinfo_like_listoffloats_entry;
+
+sub makeinfo_like_foot_line_and_ref($$$$$$$$)
+{
+ my $foot_num = shift;
+ my $relative_num = shift;
+ my $footid = shift;
+ my $docid = shift;
+ my $from_file = shift;
+ my $footnote_file = shift;
+ my $lines = shift;
+ my $state = shift;
+
+ my $foot_anchor = "<sup>" . &$anchor($docid, "$footnote_file#$footid", $relative_num) . "</sup>";
+ $foot_anchor = &$anchor($docid, "$footnote_file#$footid", "($relative_num)") if ($state->{'preformatted'});
+ unshift @$lines, "<li>";
+ push @$lines, "</li>\n";
+ return ($lines, $foot_anchor);
+}
+
+sub makeinfo_like_foot_lines($)
+{
+ my $lines = shift;
+ unshift @$lines, "<hr>\n<h4>$Texi2HTML::I18n::WORDS->{'Footnotes_Title'}</h4>\n<ol type=\"1\">\n";
+ push @$lines, "</ol>";
+ return $lines;
+}
+
+
+sub makeinfo_like_index_summary
+{
+ return '';
+}
+
+sub makeinfo_like_summary_letter
+{
+ return '';
+}
+
+sub makeinfo_like_index_entry($$$$)
+{
+ my $text_href = shift;
+ my $entry = shift;
+ my $element_href = shift;
+ my $element_text = shift;
+
+ return '<li>' . $entry . ': ' . &$anchor('', $element_href, $element_text)
+ . "</li>\n";
+}
+
+sub makeinfo_like_index_letter($$$)
+{
+ my $letter = shift;
+ my $id = shift;
+ my $text = shift;
+ return $text;
+}
+
+sub makeinfo_like_print_index($$)
+{
+ my $text = shift;
+ my $name = shift;
+ return "<ul class=\"index-$name\" compact>\n" . $text . "</ul>\n";
+}
+
+sub makeinfo_like_listoffloats_entry($$$$)
+{
+ my $style_texi = shift;
+ my $float = shift;
+ my $float_style = shift;
+ my $caption = shift;
+ my $href = shift;
+
+ if ($caption ne '')
+ {
+ return '<li>' . &$I('%{href}: %{caption}', { 'href' => &$anchor('', $href, $float_style), 'caption' => $caption }) . "</li>\n";
+ }
+ else
+ {
+ return '<li>' . &$anchor('', $href, $float_style) . "</li>\n";
+ }
+}
+
+sub makeinfo_like_listoffloats($$$)
+{
+ my $style_texi = shift;
+ my $style = shift;
+ my $float_entries = shift;
+
+ my $result = "<ul class=\"listoffloats\">\n" ;
+ foreach my $float_entry (@$float_entries)
+ {
+ $result .= $float_entry;
+ }
+ return $result . "</ul>\n";
+}
diff --git a/Build/source/utils/texi2html/examples/noheaders.init b/Build/source/utils/texi2html/examples/noheaders.init
new file mode 100644
index 00000000000..1daf77a8459
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/noheaders.init
@@ -0,0 +1,137 @@
+# -*-perl-*-
+
+$SPLIT = 'none';
+
+$print_section = \&T2H_NOHEAD_print_section;
+$end_section = \&T2H_NOHEAD_end_section;
+$one_section = \&T2H_NOHEAD_one_section;
+#$print_Top_header = \&T2H_NOHEAD_print_Top_header;
+$print_Top_footer = \&T2H_NOHEAD_print_Top_footer;
+$print_Top = \&T2H_NOHEAD_print_Top;
+$print_misc_header = \&T2H_NOHEAD_print_misc_header;
+$print_misc_footer = \&T2H_NOHEAD_print_misc_footer;
+$print_misc = \&T2H_NOHEAD_print_misc;
+$print_head_navigation = \&T2H_NOHEAD_print_head_navigation;
+$about_body = \&T2H_NOHEAD_about_body;
+#$toc_body = \&T2H_NOHEAD_toc_body;
+
+########################################################################
+# Layout for html for every sections
+#
+sub T2H_NOHEAD_print_section
+{
+ my $fh = shift;
+ my $first_in_page = shift;
+ my $previous_is_top = shift;
+
+ if ($first_in_page)
+ {
+ &$print_head_navigation($fh);
+ }
+ else
+ { # got to do this here, as it isn't done in print_head_navigation
+ main::print_lines($fh, $Texi2HTML::THIS_HEADER);
+ }
+ my $nw = main::print_lines($fh);
+}
+
+sub T2H_NOHEAD_one_section($)
+{
+ my $fh = shift;
+ main::print_lines($fh);
+ print $fh "$SMALL_RULE\n";
+ &$print_page_foot($fh);
+}
+
+###################################################################
+# Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
+# @html within the Top texinfo node to specify content of top-level
+# page.
+#
+# If you enclose everything in @ifnothtml, then title, subtitle,
+# author and overview is printed
+# Texi2HTML::HREF of Next, Prev, Up, Forward, Back are not defined
+# if $T2H_SPLIT then Top page is in its own html file
+sub T2H_NOHEAD_print_Top_footer($$)
+{
+ my $fh = shift;
+ print $fh "$SMALL_RULE\n";
+}
+sub T2H_NOHEAD_print_Top
+{
+ my $fh = shift;
+ my $has_top_heading = shift;
+
+ &$print_head_navigation($fh,[]);
+ if ($Texi2HTML::THIS_SECTION)
+ {
+ # if top-level node has content, then print it with extra header
+ #print $fh "<h1>$Texi2HTML::NAME{Top}</h1>\n"
+ print $fh "<h1 class=\"settitle\">$Texi2HTML::NAME{Top}</h1>\n"
+ unless ($has_top_heading);
+ main::print_lines($fh, $Texi2HTML::THIS_SECTION);
+ }
+ else
+ {
+ # top-level node is fully enclosed in @ifnothtml
+ # print fulltitle, subtitle, author, Overview
+ print $fh $Texi2HTML::TITLEPAGE;
+ if (@{$Texi2HTML::OVERVIEW})
+ {
+ print $fh '<h2> ' . &$I('Overview:') . "</h2>\n" . "<blockquote>\n";
+ my $nw = main::print_lines($fh, $Texi2HTML::OVERVIEW);
+ print $fh "</blockquote>\n";
+ }
+ }
+}
+
+###################################################################
+# Layout of Toc, Overview, and Footnotes pages
+# By default, we use "normal" layout
+# Texi2HTML::HREF of Next, Prev, Up, Forward, Back, etc are not defined
+# use: my $buttons = [...] to redefine navigation buttons
+sub T2H_NOHEAD_print_misc_header
+{
+ my $fh = shift;
+ &$print_page_head($fh) if $SPLIT;
+ &$print_head_navigation($fh);
+}
+sub T2H_NOHEAD_print_misc_footer
+{
+ my $fh = shift;
+ print $fh "$SMALL_RULE\n";
+ if ($SPLIT)
+ {
+ &$print_navigation($fh, $buttons);
+ &$print_page_foot($fh);
+ }
+
+}
+sub T2H_NOHEAD_print_misc
+{
+ my $fh = shift;
+ &$print_misc_header($fh);
+ print $fh "<h1>$Texi2HTML::NAME{This}</h1>\n";
+ main::print_lines($fh);
+ &$print_misc_footer($fh);
+}
+
+sub T2H_NOHEAD_end_section($)
+{
+ my $fh = shift;
+ print $fh "$MIDDLE_RULE\n";
+}
+
+###################################################################
+# Layout of navigation panel
+
+sub T2H_NOHEAD_print_head_navigation
+{
+ my $fh = shift;
+ main::print_lines($fh, $Texi2HTML::THIS_HEADER);
+}
+
+sub T2H_NOHEAD_about_body
+{
+}
+
diff --git a/Build/source/utils/texi2html/examples/roff.init b/Build/source/utils/texi2html/examples/roff.init
new file mode 100644
index 00000000000..221cb214cbf
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/roff.init
@@ -0,0 +1,1165 @@
+# -*-perl-*-
+
+main::load_init_file('', 'noheaders.init');
+
+$SPLIT = 'none';
+@EXPAND = ('info');
+$USE_ISO = 0;
+#$SHOW_MENU = 0;
+$SMALL_RULE = '';
+$DEFAULT_RULE = '';
+$MIDDLE_RULE = '';
+$BIG_RULE = '';
+$NODE_FILE_EXTENSION = "roff";
+$EXTENSION = "roff";
+$MENU_SYMBOL = '*';
+$AVOID_MENU_REDUNDANCY = 0;
+
+$print_Top = \&T2H_ROFF_print_Top;
+$print_misc = \&T2H_ROFF_print_misc;
+$print_page_head = \&T2H_ROFF_print_page_head;
+$print_page_foot = \&T2H_ROFF_print_page_foot;
+$toc_body = \&T2H_ROFF_toc_body;
+$titlepage = \&T2H_ROFF_titlepage;
+
+sub T2H_ROFF_print_page_head
+{
+ my $fh = shift;
+ print $fh <<EOT;
+.nr _- 0
+.tr \\(is'
+.tr \\(if`
+.tr \\(pd"
+
+$AFTER_BODY_OPEN
+
+EOT
+ print $fh $Texi2HTML::THISDOC{'copying'} . "\n";
+ print $fh "" . &$comment("Created on $Texi2HTML::THISDOC{today} by $Texi2HTML::THISDOC{program}\n");
+ print $fh "" . &$comment($Texi2HTML::THISDOC{program_authors});
+ print $fh ".ds St " . protect_spaces($Texi2HTML::THISDOC{'title'}) . "\n";
+ print $fh '.oh \'\\\\*(St\'\'%\'' ."\n".'.eh \'%\'\'\\\\*(St\'' . "\n";
+}
+
+sub T2H_ROFF_print_page_foot
+{
+ my $fh = shift;
+ my $program_string = program_string();
+ print $fh <<EOT;
+.br
+.pp
+$program_string
+EOT
+}
+
+sub T2H_ROFF_print_Top($$)
+{
+ my $fh = shift;
+ my $has_top_heading = shift;
+
+ my $buttons = \@MISC_BUTTONS;
+ &$print_head_navigation($fh, $buttons);
+ print $fh $Texi2HTML::TITLEPAGE;
+ main::print_lines($fh, $Texi2HTML::THIS_SECTION);
+}
+
+sub T2H_ROFF_print_misc
+{
+ my $fh = shift;
+ &$print_misc_header($fh);
+ main::print_lines($fh);
+ &$print_misc_footer($fh);
+}
+
+sub T2H_ROFF_titlepage ()
+{
+ my $result = '';
+ if (@{$Texi2HTML::THISDOC{'titles'}}
+ or @{$Texi2HTML::THISDOC{'subtitles'}}
+ or @{$Texi2HTML::THISDOC{'authors'}})
+ {
+ foreach my $title (@{$Texi2HTML::THISDOC{'titles'}})
+ {
+ $result .= ".sz +10\n.ce\n" . protect_spaces($title) . "\n.sz -10\n";
+ }
+ foreach my $subtitle (@{$Texi2HTML::THISDOC{'subtitles'}})
+ {
+ $result .= ".sz +4\n.ce\n" . protect_spaces($subtitle) . "\n.sz -4\n";
+ }
+ $result .= ".sp 4\n" if ($result ne '');
+ foreach my $author (@{$Texi2HTML::THISDOC{'authors'}})
+ {
+ $result .= protect_spaces($author) . "\n.br\n";
+ }
+ $result .= ".sp 2\n" if (@{$Texi2HTML::THISDOC{'authors'}});
+ }
+ if (($result ne '') or ($Texi2HTML::TITLEPAGE ne ''))
+ {
+ $Texi2HTML::TITLEPAGE = ".tp\n" . $result . $Texi2HTML::TITLEPAGE . ".++ C\n";
+ }
+}
+
+########################################################################
+# Control of formatting:
+# 1.) For some changes, it is often enough to change the value of
+# some global map. It might necessitate building a little
+# function along with the change in hash, if the change is the use
+# of another function (in style_map).
+# 2.) For other changes, reimplement one of the t2h_default_<fnc>* routines,
+# give them another name, and assign them to the respective
+# $<fnc> variable (below).
+
+
+#
+# This hash should have keys corresponding with the nonletter command accent
+# whose following character is considered to be the argument
+# This hash associates an accent macro to the ISO name for the accent if any.
+# The customary use of this map is to find the ISO name appearing in html
+# entity (like &eacute;) associated with a texinfo accent macro.
+#
+# The keys of the hash are
+# ": umlaut
+# ~: tilda accent
+# ^: circumflex accent
+# `: grave accent
+# ': acute accent
+# =: macron accent
+%accent_map = (
+ '"', ':',
+ '~', '~',
+ '^', '^',
+ '`', '`',
+ "'", "'",
+ '=', '',
+ );
+
+#
+# texinfo "simple things" (@foo) to HTML ones
+#
+%simple_map = (
+# "*", "\n.br\n",
+ ' ', '\ ',
+ "\t", "\\\t",
+ "\n", "\\\n",
+ # "&#173;" or "&shy;" could also be possible for @-, but it seems
+ # that some browser will consider this as an always visible hyphen mark
+ # which is not what we want (see http://www.cs.tut.fi/~jkorpela/shy.html)
+ '-', '', # hyphenation hint
+ '|', '', # used in formatting commands @evenfooting and friends
+ '/', '',
+ # spacing commands
+ ':', '',
+ '!', '!',
+ '?', '?',
+ '.', '\&.',
+ '@', '@',
+ '}', '}',
+ '{', '{',
+ );
+
+# this map is used in preformatted text
+%simple_map_pre = %simple_map;
+
+#
+# texinfo "things" (@foo{}) to HTML ones
+#
+%things_map = (
+ 'TeX' => 'TeX',
+ 'LaTeX' => 'LaTeX',
+ 'bullet' => '\(bu',
+ 'copyright' => '\(co',
+ 'registeredsymbol' => '\(rg',
+ 'dots' => '\&...',
+ 'enddots' => '\&....',
+ 'equiv' => '\(==',
+# i18n
+ 'error' => 'error->',
+ 'expansion' => '\(->',
+ 'minus' => '\-',
+ 'point' => '*',
+ 'print' => '-|',
+ 'result' => '\(rh',
+ # set in code using the language
+ # 'today', &pretty_date,
+ 'aa' => '\(oa',
+ 'AA' => '\(oA',
+ 'ae' => '\(ae',
+ 'oe' => '\(oe',
+ 'AE' => '\(AE',
+ 'OE' => '\(OE',
+ 'o' => '\(/o',
+ 'O' => '\(/O',
+ 'ss' => '\(ss',
+ 'l' => '\(/l',
+ 'L' => '\(/L',
+ 'exclamdown' => '\(r!',
+ 'questiondown' => '\(r?',
+ 'pounds' => '\(Po',
+ 'ordm' => '\(Om',
+ 'ordf' => '\(Of',
+ 'euro' => '\(eu',
+ );
+
+# This map is used in preformatted environments
+%pre_map = %things_map;
+
+#%style_map = (
+# 'acronym', '',
+# 'asis', '',
+# 'b', ['\fB', '\fR'],
+# 'cite', ['\fI', '\fR'],
+# 'code', ['\fR\&\f(CW', '\fR'],
+# 'command', ['\fR\&\f(CW', '\fR'],
+# 'ctrl', ['\fR\&\f(CW', '\fR'],
+# 'dfn', ['\fI', '\fR'],
+# 'dmn', '',
+# 'email', ['\fB', '\fR'],
+# 'emph', ['\fI', '\fR'],
+# 'env', ['\fR\&\f(CW', '\fR'],
+# 'file', ['\fR\&\f(CW', '\fR', '"'],
+# 'i', ['\fI', '\fR'],
+# 'kbd', ['\fR\&\f(CW', '\fR'],
+# 'key', ['\fR\&\f(CW', '\fR'],
+# 'math', ['\fR\&\f(CW', '\fR'],
+# 'option', ['\fR\&\f(CW', '\fR', '"'],
+# 'r', ['\fR', ''],
+# 'samp', ['\fR\&\f(CW', '\fR', '"'],
+# 'sc', '&roff_sc',
+# 'strong', ['\fB', '\fR'],
+# 't', ['\fR\&\f(CW', '\fR'],
+# 'uref', '&default_uref',
+# 'url', '&default_url',
+# 'var', ['\fI', '\fR'],
+# 'verb', ['\fR\&\f(CW', '\fR'],
+# 'titlefont', ["\n.sz +10\n.ce\n", "\n.sz -10\n"],
+# 'w', '',
+# 'H', '&roff_accent',
+# 'dotaccent', '&roff_accent',
+# 'ringaccent', '&roff_accent',
+# 'tieaccent', '&roff_accent',
+# 'u', '&roff_accent',
+# 'ubaraccent', '&roff_accent',
+# 'udotaccent', '&roff_accent',
+# 'v', '&roff_accent',
+# ',', '&roff_accent',
+# 'dotless', ''
+# );
+
+my @bold_commands = ('strong', 'b', 'email');
+my @italic_commands = ('cite', 'dfn', 'emph', 'i', 'var', 'slanted');
+my @fixed_command = ('code', 'command', 'ctrl', 'env', 'file', 'kbd', 'key',
+ 'math', 'option', 'samp', 't', 'verb');
+
+foreach my $accent_command ('tieaccent', 'dotless', keys(%unicode_accents), keys(%accent_map))
+{
+ #$style_map{$accent_command} = { 'function' => \&t2h_roff_accent };
+ $style_map{$accent_command} = '&roff_accent';
+}
+#foreach my $accent (keys(%accent_map))
+#{
+# $style_map{$accent} = '&roff_accent';
+#}
+
+foreach my $command (keys(%style_map))
+{
+ delete $style_map{$command}->{'attribute'} if (exists($style_map{$command}->{'attribute'}));
+ if (grep {$_ eq $command} @bold_commands)
+ {
+ delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
+ $style_map{$command}->{'begin'} = '\fB';
+ $style_map{$command}->{'end'} = '\fR';
+ next;
+ }
+ elsif (grep {$_ eq $command} @italic_commands)
+ {
+ delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
+ $style_map{$command}->{'begin'} = '\fI';
+ $style_map{$command}->{'end'} = '\fR';
+ next;
+ }
+ elsif (grep {$_ eq $command} @fixed_commands)
+ {
+ delete $style_map{$command}->{'function'} if (exists($style_map{$command}->{'function'}));
+ $style_map{$command}->{'begin'} = '\fR\&\f(CW';
+ $style_map{$command}->{'end'} = '\fR';
+ next;
+ }
+}
+
+delete $style_map{'titlefont'}->{'function'} if (exists($style_map{'titlefont'}->{'function'}));
+$style_map{'titlefont'}->{'begin'} = "\n.sz +10\n.ce\n";
+$style_map{'titlefont'}->{'end'} = "\n.sz -10\n";
+
+delete $style_map{'r'}->{'function'} if (exists($style_map{'r'}->{'function'}));
+$style_map{'r'}->{'begin'} = '\r';
+#$style_map{'r'}->{'end'} = '';
+
+$style_map{'sc'} = '&roff_sc';
+
+$style_map{'indicateurl'}->{'begin'} = '<';
+$style_map{'indicateurl'}->{'end'} = '>';
+
+foreach my $command (keys(%style_map))
+{
+ if (ref($style_map{$command}) ne 'HASH')
+ {
+ $style_map_pre{$command} = $style_map{$command};
+ next;
+ }
+ $style_map_pre{$command} = {};
+ foreach my $key (keys(%{$style_map{$command}}))
+ {
+ $style_map_pre{$command}->{$key} = $style_map{$command}->{$key};
+ }
+}
+
+%special_accents = (
+ 'ringaccent' => 'aA',
+ "'" => 'aeiouyAEIOUY',
+ ',' => 'cC',
+ '^' => 'aeiouAEIOU',
+ '`' => 'aeiouAEIOU',
+ '~' => 'nNaoAO',
+ '"' => 'aeiouyAEIOUY',
+ 'v' => 'sSzZ',
+);
+
+sub roff_accent($$)
+{
+ my $text = shift;
+ my $accent = shift;
+ return $text if ($accent eq 'dotless');
+ return "\\($accent_map{$accent}${text}" if (defined($accent_map{$accent}) and defined($special_accents{$accent}) and ($text =~ /^[$special_accents{$accent}]$/));
+ return "\\(o${text}" if (($accent eq 'ringaccent') and (defined($special_accents{$accent})) and ($text =~ /^[$special_accents{$accent}]$/));
+ return "\\(v${text}" if (($accent eq 'v') and (defined($special_accents{$accent})) and ($text =~ /^[$special_accents{$accent}]$/));
+ return "\\(,${text}" if (($accent eq ',') and (defined($special_accents{$accent})) and ($text =~ /^[$special_accents{$accent}]$/));
+#FIXME maybe we should protect the symbols such that they look like strings and
+# not ponctuation marks ? Like it is done in texi2roff ?
+# otherwise we should use
+# return ascii_accents($text, $accent);
+ return $text . $accent if (defined($accent_map{$accent}));
+ return $text . "''" if ($accent eq 'H');
+ return $text . '\\&.' if ($accent eq 'dotaccent');
+ return $text . '*' if ($accent eq 'ringaccent');
+ return $text . '[' if ($accent eq 'tieaccent');
+ return $text . '(' if ($accent eq 'u');
+ return $text . '_' if ($accent eq 'ubaraccent');
+ return '\\&.' . $text if ($accent eq 'udotaccent');
+ return $text . '<' if ($accent eq 'v');
+ return $text . ',' if ($accent eq ',');
+}
+
+sub roff_sc($$)
+{
+ return "\n.sz -6\n" . uc($_[0]) . "\n.sz +6\n" ;
+}
+
+sub roff_ctrl($$)
+{
+ return "\\*^$_[0]";
+}
+
+$format = \&T2H_ROFF_format;
+
+sub T2H_ROFF_format($$$)
+{
+ my $tag = shift;
+ my $element = shift;
+ my $text = shift;
+ return '' if (!defined($element) or ($text !~ /\S/));
+ return $element->[0] . $text . $element->[1];
+}
+
+%format_map = (
+ 'quotation' => [ ".(q\n", ".)q\n" ],
+ # lists
+ 'itemize' => [ ".(l L F\n.ba +5\n", ".ba -5\n.)l\n" ],
+ 'enumerate' => [ ".(l L F\n.ba +5\n", ".ba -5\n.)l\n" ],
+ 'multitable' => [ ".(l M\n.nh\n", ".hy\n.)l\n" ],
+ 'table' => [ ".(l L F\n.ba +5\n", ".ba -5\n.)l\n" ],
+ 'vtable' => [ ".(l L F\n.ba +5\n", ".ba -5\n.)l\n" ],
+ 'ftable' => [ ".(l L F\n.ba +5\n", ".ba -5\n.)l\n" ],
+ );
+
+%special_list_commands = (
+ 'table' => {},
+ 'vtable' => {},
+ 'ftable' => {},
+ 'itemize' => {}
+ );
+
+# an eval of these $complex_format_map->{what}->{'begin'} yields beginning
+# an eval of these $complex_format_map->{what}->{'end'} yields end
+# $EXAMPLE_INDENT_CELL and SMALL_EXAMPLE_INDENT_CELL can be usefull here
+$complex_format_map =
+{
+ 'example' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => ".(l I\n\\&\\fR\\f(CW",
+ 'end_region' => "\\&\\fR\n.)l\n"
+ },
+ 'smallexample' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => ".(l I\n.size -2\n\\&\\fR\\f(CW",
+ 'end_region' => "\\&\\fR\n.size +2\n.)l\n"
+ },
+ 'display' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => ".(l I\n\\&\\fR\\f(CW",
+ 'end_region' => "\\&\\fR\n.)l\n"
+ },
+ 'smalldisplay' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => ".(l I\n.size -2\n\\&\\fR\\f(CW",
+ 'end_region' => "\\&\\fR\n.size +2\n.)l\n"
+ },
+ 'menu-comment' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => "",
+ 'end_region' => "\n"
+ },
+ 'menu-preformatted' =>
+ {
+ 'begin' => q{""},
+ 'end' => q{""},
+ 'begin_region' => "",
+ 'end_region' => "\n"
+ }
+};
+
+# format shouldn't narrow the margins
+
+$complex_format_map->{'lisp'} = $complex_format_map->{'example'};
+$complex_format_map->{'smalllisp'} = $complex_format_map->{'smallexample'};
+$complex_format_map->{'format'} = $complex_format_map->{'display'};
+$complex_format_map->{'smallformat'} = $complex_format_map->{'smalldisplay'};
+
+sub protect_spaces($)
+{
+ my $text = shift;
+ my $result = '';
+ while($text)
+ {
+ if ($text =~ s/^([^\\]*)\\//o)
+ {
+ my $leading = $1;
+ if (defined($leading))
+ {
+ $leading =~ s/([\t ])/\\$1/go;
+ $result .= $leading . '\\';
+ }
+ if (($text =~ s/^(\s)//o) or ($text =~ s/^(.)//o))
+ {
+ $result .= $1;
+ }
+ }
+ else
+ {
+ $text =~ s/([\t ])/\\$1/go;
+ $result .= $text;
+ $text = '';
+ }
+ }
+ return $result;
+}
+
+# formatting functions
+
+$anchor = \&t2h_roff_anchor;
+$def_item = \&t2h_roff_def_item;
+$def = \&t2h_roff_def;
+$menu = \&t2h_roff_menu;
+$menu_link = \&t2h_roff_menu_link;
+$menu_comment = \&t2h_roff_menu_comment;
+$menu_description = \&t2h_roff_menu_description;
+$simple_menu_link = \&t2h_roff_simple_menu_link;
+$table_item = \&t2h_roff_table_item;
+$table_line = \&t2h_roff_table_line;
+$row = \&t2h_roff_row;
+$cell = \&t2h_roff_cell;
+$list_item = \&t2h_roff_list_item;
+$comment = \&t2h_roff_comment;
+$def_line = \&t2h_roff_def_line;
+$raw = \&t2h_roff_raw;
+$heading = \&t2h_roff_heading;
+$paragraph = \&t2h_roff_paragraph;
+$preformatted = \&t2h_roff_preformatted;
+$foot_line_and_ref = \&t2h_roff_foot_line_and_ref;
+$foot_section = \&t2h_roff_foot_section;
+$image = \&t2h_roff_image;
+$index_entry_label = \&t2h_roff_index_entry_label;
+$index_summary = \&t2h_roff_index_summary;
+$print_index = \&t2h_roff_print_index;
+$protect_text = \&t2h_roff_protect_text;
+$cartouche = \&t2h_roff_cartouche;
+$sp = \&t2h_roff_sp;
+$normal_text = \&t2h_roff_normal_text;
+$empty_line = \&t2h_roff_empty_line;
+$unknown = \&t2h_roff_unknown;
+$float = \&t2h_roff_float;
+$listoffloats = \&t2h_roff_listoffloats;
+$listoffloats_entry = \&t2h_roff_listoffloats_entry;
+
+# This function is used to protect characters which are special in html
+# in inline text: &, ", <, and >.
+#
+# argument:
+# text to be protected
+sub t2h_roff_protect_text($)
+{
+ my $text = shift;
+ $text =~ s/\\/\\e/g;
+ $text =~ s/$;---$;/\\(em/g;
+ $text =~ s/$;--$;/-/g;
+ $text =~ s/$;-$;/\\-/g;
+ $text =~ s/^\./\\&./;
+ $text =~ s/([\s])\./$1\\&./g;
+ return $text;
+}
+
+sub t2h_roff_normal_text($)
+{
+ my $text = shift;
+ #$text =~ s/---/\\(em/g;
+ $text =~ s/(--?-?)/$;$1$;/go;
+ return $text;
+}
+
+sub t2h_roff_unknown($$)
+{
+ my $macro = shift;
+ my $line = shift;
+
+ if ($macro eq '*')
+ {
+ $line = '' if ($line =~ /^\s*$/);
+ return ($line, 1, "\n.br\n", undef);
+ }
+ return ($line, 0, undef, undef);
+}
+
+
+# This function produces an anchor
+#
+# arguments:
+# $name : anchor name
+# $href : anchor href
+# text : text displayed
+# extra_attribs : added to anchor attributes list
+sub t2h_roff_anchor($;$$$)
+{
+ my $name = shift;
+ my $href = shift;
+ my $text = shift;
+ my $attributes = shift;
+ $href = '' if (!defined($href) or ($href !~ /\S/));
+ $text = '' if (!defined($text));
+ return $text if ($text ne '');
+ return "[$href]" if ($href ne '');
+ return '';
+}
+
+# This function is used to format the text associated with a @deff/@end deff
+#
+# argument:
+# text
+sub t2h_roff_def_item($)
+{
+ my $text = shift;
+ if ($text =~ /\S/)
+ {
+ {
+ #return ".ba +5\n.(l L F\n" . $text . ".)l\n.ba -5\n";
+ return ".(l L F\n.ba +5\n" . $text . ".ba -5\n.)l\n";
+ }
+ }
+ return '';
+}
+
+# format the container for the @deffn line and text
+#
+# argument
+# text of the whole @def, line and associated text.
+sub t2h_roff_def($)
+{
+ my $text = shift;
+ return $text;
+}
+
+# a whole menu
+#
+# argument:
+# the whole menu text (entries and menu comments)
+#
+# argument:
+# whole menu text.
+sub t2h_roff_menu($)
+{
+ my $text = shift;
+ chomp $text;
+ return ".(l M\n\\&\\s8" . &$I('Menu:') . "\n" . $text . "\\&\\s0\n.)l\n";
+}
+
+# a simple menu entry ref in case we aren't in a standard menu context
+sub t2h_roff_simple_menu_link($$$$$)
+{
+ my $text = shift;
+ my $href = shift;
+ my $node = shift;
+ my $name = shift;
+ my $ending = shift;
+ $name .= ':' if ($name ne '');
+ return "$MENU_SYMBOL$name$node$ending";
+}
+
+# formats a menu entry link pointing to a node or section
+#
+# arguments:
+# the entry text
+# the state, a hash reference holding informations about the context, with a
+# usefull entry, 'preformatted', true if we are in a preformatted format
+# (a format keeping space between words). In that case a function
+# of the main program, main::do_preformatted($text, $state) might
+# be used to format the text with the current format style.
+# href is optionnal. It is the reference to the section or the node anchor
+# which should be used to make the link (typically it is the argument
+# of a href= attribute in a <a> element).
+sub t2h_roff_menu_link($$$$$$)
+{
+ my $text = shift;
+ my $state = shift;
+ my $href = shift;
+ my $node = shift;
+ my $name = shift;
+ my $ending = shift;
+ $name .= ':' if ($name ne '');
+ return "$MENU_SYMBOL$name$node$ending";
+}
+
+# formats a menu entry description, ie the text appearing after the node
+# specification in a menu entry an spanning until there is another
+# menu entry, an empty line or some text at the very beginning of the line
+# (we consider that text at the beginning of the line begins a menu comment)
+#
+# arguments:
+# the description text
+# the state. See menu_entry.
+sub t2h_roff_menu_description($$)
+{
+ my $text = shift;
+ my $state = shift;
+ return $text;
+}
+
+# a menu comment (between menu lines)
+# formats the container of a menu comment. A menu comment is any text
+# appearing between menu lines, either separated by an empty line from
+# the preceding menu entry, or a text beginning at the first character
+# of the line (text not at the very beginning of the line is considered to
+# be the continuation of a menu entry description text).
+#
+# The text itself is considered to be in a preformatted environment
+# with name 'menu-commment' and with style $MENU_PRE_STYLE.
+#
+# argument
+# text contained in the menu comment.
+sub t2h_roff_menu_comment($)
+{
+ my $text = shift;
+ return $text;
+}
+
+# text after @item in table, vtable and ftable
+sub t2h_roff_table_item($$$$$)
+{
+ my $text = shift;
+ my $index_label = shift;
+ my $format = shift;
+ my $command = shift;
+ my $formatted_command = shift;
+ $formatted_command = '' if (!defined($formatted_command) or
+ exists($special_list_commands{$format}->{$command}));
+ $text = '.ip ' . $formatted_command . protect_spaces($text) . "\n";
+ $text .= $index_label if (defined($index_label));
+ return $text;
+}
+
+# format text on the line following @item (in table, vtable and ftable)
+sub t2h_roff_table_line($)
+{
+ my $text = shift;
+ return $text;
+}
+
+# row in multitable
+sub t2h_roff_row($)
+{
+ my $text = shift;
+
+ if ($text =~ /\S/)
+ {
+ return $text ."\n" ;
+ }
+ return '';
+}
+
+# cell in multitable
+sub t2h_roff_cell($)
+{
+ my $text = shift;
+ chomp $text;
+ return protect_spaces($text) . "\\\t";
+}
+
+# format an item in a list
+#
+# argument:
+# text of the item
+sub t2h_roff_list_item($$$$$$$)
+{
+ my $text = shift;
+ my $format = shift;
+ my $command = shift;
+ my $formatted_command = shift;
+ my $item_nr = shift;
+ my $enumerate_style = shift;
+ my $number = shift;
+ $formatted_command = '' if (!defined($formatted_command) or
+ exists($special_list_commands{$format}->{$command}));
+ if ($text =~ /\S/)
+ {
+ #return $formatted_command . $text;
+ return $text . "\n";
+ }
+ return '';
+}
+
+# an comment
+sub t2h_roff_comment($)
+{
+ my $text = shift;
+ my $result = '';
+ while ($text)
+ {
+ $text =~ s/$;---$;/--/g;
+ $text =~ s/$;--$;/-/g;
+ $text =~ s/$;-$;/-/g;
+ $text =~ s/^(.*)//;
+ $result .= ".\\\"$1";
+ $result .= "\n" if ($text =~ s/^\n//);
+ }
+ return $result;
+}
+
+# a paragraph
+sub t2h_roff_paragraph($$$$$$$$$)
+{
+ my $text = shift;
+ my $align = shift;
+ my $paragraph_command = shift;
+ my $paragraph_command_formatted = shift;
+ my $paragraph_number = shift;
+ my $format = shift;
+ my $item_nr = shift;
+ my $enumerate_style = shift;
+ my $number = shift;
+ return '' if ($text =~ /^\s*$/);
+ if (defined($paragraph_number) and defined($$paragraph_number))
+ {
+ $$paragraph_number++;
+ $paragraph_command_formatted = undef if ($$paragraph_number > 1);
+ }
+ $paragraph_command_formatted = '' if (!defined($paragraph_command_formatted) or
+ exists($special_list_commands{$format}->{$paragraph_command}));
+ #return $text if (defined($format) and $format eq 'multitable');
+ return $text if (defined($format) and (($format eq 'multitable') or ($format eq 'quotation')));
+ my $open = ".pp\n";
+ if (defined($format) and (($format eq 'itemize') or ($format eq 'enumerate')) and
+ defined($paragraph_number) and defined($$paragraph_number) and ($$paragraph_number == 1))
+ {
+ $open = ".lp\n";
+ }
+ my $close = '';
+ if ($align)
+ {
+ if ($align eq 'flushleft')
+ {
+ $open .= ".ad l\n";
+ $close .= ".ad b\n";
+ }
+ elsif ($align eq 'flushright')
+ {
+ $open .= ".ad r\n";
+ $close .= ".ad b\n";
+ }
+ elsif ($align eq 'center')
+ {
+ $open .= ".ce\n";
+ }
+ }
+ if (defined($format) and ($format eq 'enumerate') and
+ defined($paragraph_number) and defined($$paragraph_number) and ($$paragraph_number == 1) and defined($number) and ($number ne ''))
+ {
+ $open .= "$number.";
+ }
+ chomp ($text);
+ return $open. $paragraph_command_formatted . $text . "\n" . $close;
+}
+
+# a preformatted region
+sub t2h_roff_preformatted($$$$$$$$$$)
+{
+ my $text = shift;
+ my $pre_style = shift;
+ my $class = shift;
+ my $leading_command = shift;
+ my $leading_command_formatted = shift;
+ my $preformatted_number = shift;
+ my $format = shift;
+ my $item_nr = shift;
+ my $enumerate_style = shift;
+ my $number = shift;
+ $leading_command_formatted = '' if (!defined($leading_command_formatted) or
+ exists($special_list_commands{$format}->{$leading_command}));
+
+ if (defined($format) and $format eq 'multitable')
+ {
+ my $chomped = chomp($text);
+ my $result = '\&\fR\f(CW' . $text . '\&\fR';
+ $result .= "\n" if ($chomped);
+ return $result;
+ }
+ return '' if ($text eq '');
+ if (defined($preformatted_number) and defined($$preformatted_number))
+ {
+ $$preformatted_number++;
+ $leading_command_formatted = undef if ($$preformatted_number > 1);
+ }
+ $leading_command_formatted = '' if (!defined($leading_command_formatted));
+ chomp $text;
+ my $open = '';
+ if (defined($format) and ($format eq 'enumerate') and
+ defined($paragraph_number) and defined($$paragraph_number) and ($$paragraph_number == 1) and defined($number) and ($number ne ''))
+ {
+ $open = "$number. ";
+ }
+ return $complex_format_map->{$class}->{'begin_region'} . $leading_command_formatted . $open . $text . $complex_format_map->{$class}->{'end_region'};
+}
+
+# This function formats a heading for an element
+#
+# argument:
+# an element. It is a hash reference for a node or a sectionning command.
+# The interesting keys are:
+# 'text': the heading text
+# 'name': the heading text without section number
+# 'node': true if it is a node
+# 'level': level of the element. 0 for @top, 1 for chapter, heading,
+# appendix..., 2 for section and so on...
+# 'tag_level': the sectionning element name, raisesections and lowersections
+# taken into account
+#
+# relevant configuration variable:
+# $NUMBER_SECTIONS
+sub t2h_roff_heading($)
+{
+ my $element = shift;
+ my $name = $element->{'text'};
+ if (!$element->{'node'})
+ {
+ $name = $element->{'name'};
+ }
+ return '' if ($element->{'name'} !~ /\S/);
+ my $class = $element->{'tag_level'};
+ $class = 'unnumbered' if ($class eq 'top');
+ $level = $element->{'level'};
+ $level = 3 if (!defined($level));
+ $level = 1 if ($level == 0);
+ my $heading = '';
+ $heading = ".bp\n" if ($level == 1);
+ $heading .= '.if !\n(_- \{\\' . "\n.nr _- 1\n.nr \$1 0 1\n" . '.af $1 A\}' . "\n"
+ if ($class =~ /^appendix/);
+ $name = protect_spaces($name);
+ my $toc_entry = '\&';
+ if ($class =~ /^unnumbered/ or ($class eq 'node'))
+ {
+ $heading .= ".uh $name\n";
+ $toc_entry .= ' ';
+ }
+ elsif (($class =~ /section$/) or ($class eq 'chapter') or ($class =~ /^appendix/))
+ {
+ $heading .= ".sh $level $name\n";
+ my $number = 1;
+ while ($number < $level)
+ {
+ $toc_entry .= "\\n(\$$number.";
+ $number++;
+ }
+ $toc_entry .= "\\n(\$$number ";
+ }
+ $toc_entry .= $name;
+ return $heading . "\n" if ($class eq 'node');
+ return $heading . ".(x\n" . $toc_entry . "\n.)x\n\\&\\fR\n";
+}
+
+sub T2H_ROFF_toc_body($$$)
+{
+ my $elements_list = shift;
+ my $do_contents = shift;
+ my $do_scontents = shift;
+ if ($do_contents or $do_scontents)
+ {
+ my $lines = ".pp\n.nr % 0 1\n.af % i\n.bp \\n%+1\n.ce\n\\&\\fB" . &$I('Table of Contents') . "\\fR\n.sp 2\n.xp\n";
+ if (!$do_contents)
+ {
+ push @{$Texi2HTML::OVERVIEW}, $lines;
+ }
+ else
+ {
+ push @{$Texi2HTML::TOC_LINES}, $lines;
+ }
+ }
+}
+
+# formatting of raw regions
+# ih L2H is true another mechanism is used for tex
+sub t2h_roff_raw($$)
+{
+ my $style = shift;
+ my $text = shift;
+ if ($style eq 'verbatim' or $style eq 'tex' or $style eq 'html')
+ {
+ chomp ($text);
+ return ".(l M\n\\fR\\&\\f(CW" . &$protect_text($text) . "\\fR\n.)l\n" ;
+ }
+ else
+ {
+ warn "$WARN (bug) unknown style $style\n";
+ return &$protect_text($text);
+ }
+}
+
+# This function formats a footnote reference and the footnote text associated
+# with a given footnote.
+# The footnote reference is the text appearing in the main document pointing
+# to the footnote text.
+#
+# arguments:
+# absolute number of the footnote (in the document)
+# relative number of the footnote (in the page)
+# identifier for the footnote
+# identifier for the footnote reference in the main document
+# main document file
+# footnote text file
+# array with the footnote text lines
+# the state. See menu entry.
+#
+# returns:
+# reference on an array containing the footnote text lines which should
+# have been updated
+# the text for the reference pointing on the footnote text
+sub t2h_roff_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;
+
+ my $text = '';
+ my $line;
+ while (@$lines)
+ {
+ $line = shift @$lines;
+ $text .= $line;
+ }
+ chomp $text;
+ return ([], "\n.(f\n" . $text . "\n.)f\n" );
+}
+
+# formats a group of footnotes.
+#
+# argument:
+# array reference on the footnotes texts lines
+#
+# returns an array reference on the group of footnotes lines
+sub t2h_roff_foot_section($)
+{
+ my $lines = shift;
+ @$lines = ();
+}
+
+# format an image
+#
+# arguments:
+# image file name
+# image basename
+# a boolean true if we are in a preformatted format
+sub t2h_roff_image($$$$)
+{
+ my $file = shift;
+ my $base = shift;
+ my $preformatted = shift;
+ my $file_name = shift;
+ return "[$base src=$file_name]" if ($base ne $file_name);
+ return "[$base]";
+}
+
+# format a target in the main document for an index entry.
+#
+# arguments:
+# target identifier
+# boolean true if in preformatted format
+sub t2h_roff_index_entry_label($$$$)
+{
+ my $identifier = shift;
+ my $preformatted = shift;
+ my $label = shift;
+ my $index_name = shift;
+ return ".(x $index_name\n" . protect_spaces($label) . "\n.)x\n";
+}
+
+# process definition commands line @deffn for example
+sub t2h_roff_def_line($$$$$)
+{
+ my $category = shift;
+ my $name = shift;
+ my $type = shift;
+ my $arguments = shift;
+ my $index_label = shift;
+ $index_label = '' if (!defined($index_label));
+ $name = '' if (!defined($name) or ($name =~ /^\s*$/));
+ $type = '' if (!defined($type) or $type =~ /^\s*$/);
+ if (!defined($arguments) or $arguments =~ /^\s*$/)
+ {
+ $arguments = '';
+ }
+ else
+ {
+ $arguments = '\fI' . protect_spaces($arguments) . '\fR';
+ }
+ my $type_name = ' ';
+ $type_name = " $type" if ($type ne '');
+
+ $type_name .= '\fB' . protect_spaces($name) . '\fR' if ($name ne '');
+ $type_name .= $arguments . "\n";
+ return '\fI' . protect_spaces($category) . ':\fR' . $type_name . $index_label;
+}
+
+# a cartouche
+sub t2h_roff_cartouche($$)
+{
+ my $text = shift;
+ return $text;
+}
+
+sub t2h_roff_sp($$)
+{
+ my $number = shift;
+ my $preformatted = shift;
+ return "\n.sp $number\n";
+}
+
+# format a whole index
+#
+# argument:
+# index text
+# index name
+sub t2h_roff_print_index($$)
+{
+ my $text = shift;
+ my $name = shift;
+ return ".xp $name\n";
+}
+
+# format an index summary. This is a list of letters linking to the letter
+# entries.
+#
+# arguments:
+# array reference containing the formatted alphabetical letters
+# array reference containing the formatted non lphabetical letters
+sub t2h_roff_index_summary($$)
+{
+ my $alpha = shift;
+ my $nonalpha = shift;
+ my $join = '';
+ my $nonalpha_text = '';
+ my $alpha_text = '';
+ return '';
+}
+
+# FIXME the following construct leads to something wrong ?
+# something @c a comment
+#
+# other thing
+sub t2h_roff_empty_line($)
+{
+ my $text = shift;
+ return '';
+}
+
+sub t2h_roff_listoffloats_entry($$$$)
+{
+ my $style_texi = shift;
+ my $float = shift;
+ my $float_style = shift;
+ my $caption = shift;
+ my $href = shift;
+ chomp ($caption);
+
+ return '.ip ' . protect_spaces($float_style) . "\n" . $caption . "\n";
+}
+
+sub t2h_roff_listoffloats($$$)
+{
+ my $style_texi = shift;
+ my $style = shift;
+ my $float_entries = shift;
+
+ my $result = ".(l L F\n.ba +5\n";
+ foreach my $float_entry (@$float_entries)
+ {
+ $result .= $float_entry;
+ }
+ return $result . ".ba -5\n.)l\n";
+}
+
+sub t2h_roff_float($$$$$)
+{
+ my $text = shift;
+ my $float = shift;
+ my $caption = shift;
+ my $shortcaption = shift;
+
+ my $caption_text = '';
+
+ if (defined($float->{'caption_texi'}))
+ {
+ $caption_text = $caption;
+ }
+ elsif (defined($float->{'shortcaption_texi'}))
+ {
+ $caption_text = $shortcaption;
+ }
+ elsif (defined($caption))
+ {
+ $caption_text = $caption;
+ }
+ chomp ($caption_text);
+ return ".(b L F\n" . $text . $caption_text . "\n.b)\n";
+}
+
+1;
diff --git a/Build/source/utils/texi2html/examples/utf8.init b/Build/source/utils/texi2html/examples/utf8.init
new file mode 100644
index 00000000000..2d231e30a8f
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/utf8.init
@@ -0,0 +1,27 @@
+# -*-perl-*-
+$USE_ISO = 0;
+$ENCODING = 'utf-8';
+
+# if the encoding isn't utf-8, we should convert to utf-8 characters.
+
+use Encode;
+use Unicode::Normalize;
+
+foreach my $key (keys(%unicode_accents))
+{
+ $style_map{$key}->{'function'} = \&t2h_utf8_accent;
+ $style_map_texi{$key}->{'function'} = \&t2h_utf8_accent;
+}
+
+foreach my $key (%things_map)
+{
+ if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
+ {
+ $things_map{$key} = chr(hex($unicode_map{$key}));
+ $texi_map{$key} = chr(hex($unicode_map{$key}));
+ }
+}
+
+$normal_text = \&t2h_utf8_normal_text;
+
+1;
diff --git a/Build/source/utils/texi2html/examples/xhtml.init b/Build/source/utils/texi2html/examples/xhtml.init
new file mode 100644
index 00000000000..3343a95c935
--- /dev/null
+++ b/Build/source/utils/texi2html/examples/xhtml.init
@@ -0,0 +1,188 @@
+# -*-perl-*-
+
+# APA: Add SystemLiteral to identify the canonical DTD.
+# [Definition:] The SystemLiteral is called the entity's system
+# identifier. It is a URI, which may be used to retrieve the entity.
+# See http://www.xml.com/axml/target.html#NT-ExternalID
+$DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/xhtml1-transitional.dtd">';
+
+$FRAMESET_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/xhtml1-frameset.dtd">';
+
+# -iso
+# if set, ISO8859 characters are used for special symbols (like copyright, etc)
+$USE_ISO = 1;
+
+# horizontal rules
+$SMALL_RULE = '<hr size="1"/>';
+$DEFAULT_RULE = '<hr/>';
+$MIDDLE_RULE = '<hr size="2"/>';
+$BIG_RULE = '<hr size="6"/>';
+
+# this is added inside <head></head> after <title> and some <meta name>
+# stuff, it can be used for eg. <style>, <script>, <meta> etc. tags.
+$EXTRA_HEAD = '';
+
+$print_page_head = \&T2H_XHTML_print_page_head;
+$print_page_foot = \&T2H_XHTML_print_page_foot;
+$print_frame = \&T2H_XHTML_print_frame;
+$button_icon_img = \&T2H_XHTML_button_icon_img;
+
+#FIXME update once it is more stabilized in texi2html.init
+sub T2H_XHTML_print_page_head
+{
+ my $fh = shift;
+ my $longtitle = "$Texi2HTML::THISDOC{'title_no_texi'}";
+ $longtitle .= ": $Texi2HTML::NO_TEXI{'This'}" if exists $T2H_NO_TEXI{'This'};
+ print $fh <<EOT;
+<?xml version="1.0" encoding="iso-8859-1"?>
+$T2H_DOCTYPE
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$T2H_LANG" lang="$T2H_LANG">
+$T2H_THISDOC{'copying'}<!-- Created on $Texi2HTML::THISDOC{today} by $Texi2HTML::THISDOC{program} -->
+<!--
+$Texi2HTML::THISDOC{program_authors}
+-->
+<head>
+<title>$longtitle</title>
+
+<meta name="description" content="$longtitle"/>
+<meta name="keywords" content="$longtitle"/>
+<meta name="resource-type" content="document"/>
+<meta name="distribution" content="global"/>
+<meta name="Generator" content="$T2H_THISDOC{program}"/>
+$EXTRA_HEAD
+</head>
+
+<body $T2H_BODYTEXT>
+$AFTER_BODY_OPEN
+EOT
+}
+
+# <span> instead of <font>
+sub T2H_XHTML_print_page_foot
+{
+ my $fh = shift;
+ print $fh <<EOT;
+<p>
+ <span style="font-size: smaller">
+ This document was generated $ADDRESS
+ using <a href="$T2H_THISDOC{program_homepage}"><i>$Texi2HTML::THISDOC{program}</i></a>.
+ </span>
+ <br/>
+$PRE_BODY_CLOSE
+</p>
+</body>
+</html>
+EOT
+}
+
+sub T2H_XHTML_print_frame
+{
+ my $fh = shift;
+ my $toc_file = shift;
+ my $main_file = shift;
+ print $fh <<EOT;
+$FRAMESET_DOCTYPE
+<html>
+<head><title>$Texi2HTML::THISDOC{title}</title></head>
+<frameset cols="140,*">
+ <frame name="toc" src="$toc_file"/>
+ <frame name="main" src="$main_file"/>
+</frameset>
+</html>
+EOT
+}
+
+# / in <img>
+sub T2H_XHTML_button_icon_img
+{
+ my $button = shift;
+ my $icon = shift;
+ my $name = shift;
+ return '' if (!defined($icon));
+ if (defined($name) && $name)
+ {
+ $name = ": $name";
+ }
+ else
+ {
+ $name = '';
+ }
+ $button = "" if (!defined ($button));
+ return qq{<img src="$icon" border="0" alt="$button$name" align="middle"/>};
+}
+
+$simple_map{'*'} = '<br/>';
+
+# formatting functions
+
+$def_line = \&t2h_xhtml_def_line;
+$index_summary = \&t2h_xhtml_index_summary;
+$image = \&t2h_xhtml_image;
+
+# need / in <img>
+sub t2h_xhtml_image($$$)
+{
+ my $file = shift;
+ my $base = shift;
+ my $preformatted = shift;
+ return "[ $base ]" if ($preformatted);
+ return "<img src=\"$file\" alt=\"$base\"/>";
+}
+
+# process definition commands line @deffn for example
+# <u> replaced by <span>
+sub t2h_xhtml_def_line($$$$$)
+{
+ my $category = shift;
+ my $name = shift;
+ my $type = shift;
+ my $arguments = shift;
+ my $index_label = shift;
+ $index_label = '' if (!defined($index_label));
+ $name = '' if (!defined($name) or ($name =~ /^\s*$/));
+ $type = '' if (!defined($type) or $type =~ /^\s*$/);
+ if (!defined($arguments) or $arguments =~ /^\s*$/)
+ {
+ $arguments = '';
+ }
+ else
+ {
+ $arguments = '<i>' . $arguments . '</i>';
+ }
+ my $type_name = '';
+ $type_name = " $type" if ($type ne '');
+ $type_name .= ' <b>' . $name . '</b>' if ($name ne '');
+ $type_name .= $arguments . "\n";
+ if (! $DEF_TABLE)
+ {
+ return '<dt>'. '<span style="text-decoration: underline">' . $category . ':</span>' . $type_name . $index_label . "</dt>\n";
+ }
+ else
+ {
+
+ return "<tr>\n<td align=\"left\">" . $type_name .
+ "</td>\n<td align=\"right\">" . $category . $index_label . "</td>\n" . "</tr>\n";
+ }
+}
+
+# There is a br which needs /
+sub t2h_xhtml_index_summary($$)
+{
+ my $alpha = shift;
+ my $nonalpha = shift;
+ my $join = '';
+ my $nonalpha_text = '';
+ my $alpha_text = '';
+ $join = " &nbsp; \n<br/>\n" if (@$nonalpha and @$alpha);
+ if (@$nonalpha)
+ {
+ $nonalpha_text = join("\n &nbsp; \n", @$nonalpha) . "\n";
+ }
+ if (@$alpha)
+ {
+ $alpha_text = join("\n &nbsp; \n", @$alpha) . "\n &nbsp; \n";
+ }
+ #I18n
+ return "<table><tr><th valign=\"top\">Jump to: &nbsp; </th><td>" .
+ $nonalpha_text . $join . $alpha_text . '</td></tr></table>';
+}