summaryrefslogtreecommitdiff
path: root/Build/source/utils/texi2html/examples/xhtml.init
blob: 3343a95c9351793202c0365a33612a70af21ed52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
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>';
}