File: texi2html.tpl

package info (click to toggle)
yorick 2.2.04%2Bdfsg1-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 10,012 kB
  • sloc: ansic: 86,757; sh: 1,697; cpp: 1,309; lisp: 1,234; makefile: 1,050; fortran: 19
file content (209 lines) | stat: -rw-r--r-- 6,405 bytes parent folder | download | duplicates (8)
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# -*-perl-*-
# texi2html homepage:
# http://www.mathematik.uni-kl.de/~obachman/Texi2html
# texi2html -init_file texi2html.init yorick.tex

$print_page_foot	      = \&no_print_page_foot;        
$ICONS = 1;
$SPLIT = 'node';

$EXTRA_HEAD = <<'EOF';
%extra_head%
EOF

$AFTER_BODY_OPEN = <<'EOF';
%after_body_open%
EOF

$PRE_BODY_CLOSE = <<'EOF';
%pre_body_close%
EOF

# specify in this array which "buttons" should appear in which order
# in the navigation panel for sections; use ' ' for empty buttons (space)
@SECTION_BUTTONS =
    (
     'Back', 'Forward', ' ', 'FastBack', 'Up', 'FastForward',
     ' ', ' ', ' ', ' ',
     'Top', 'Contents', 'About',
    );

# buttons for misc stuff
@MISC_BUTTONS = ('Top', 'Contents', 'About');

@NODE_FOOTER_BUTTONS =
    (
     'Back', 'Forward', ' ', 'FastBack', 'Up', 'FastForward',
     ' ', ' ', ' ', ' ',
     'Top', 'Contents', 'About',
#     'Back', 'Forward', ' ', 'FastBack', 'Up', 'FastForward'
    );

# insert here name of icon images for buttons 
# Icons are used, if $ICONS and resp. value are set
%ACTIVE_ICONS =
  (
   'Top',      '../images/a_top.gif',
   'Contents', '../images/a_tableofcon.gif',
   'Overview', '',
   'Index',    '../images/a_index.gif',
   'Back',     '../images/a_left.gif',
   'FastBack', '../images/a_leftdouble.gif',
   'Prev',     '../images/a_left.gif',
   'Up',       '../images/a_up.gif',
   'Next',     '../images/a_right.gif',
   'Forward',  '../images/a_right.gif',
   'FastForward', '../images/a_rightdouble.gif',
   'About' ,    '../images/a_help.gif',
   'First',    '../images/a_begin.gif',
   'Last',     '../images/a_end.gif',
   ' ',        ''
  );
%PASSIVE_ICONS =
  (
   'Top',      '../images/a_top_na.gif',
   'Contents', '../images/a_tableofcon_na.gif',
   'Overview', '',
   'Index',    '../images/a_index_na.gif',
   'Back',     '../images/a_left_na.gif',
   'FastBack', '../images/a_leftdouble_na.gif',
   'Prev',     '../images/a_left_na.gif',
   'Up',       '../images/a_up_na.gif',
   'Next',     '../images/a_right_na.gif',
   'Forward',  '../images/a_right_na.gif',
   'FastForward', '../images/a_rightdouble_na.gif',
   'About' ,    '../images/a_help_na.gif',
   'First',    '../images/a_begin_na.gif',
   'Last',     '../images/a_end_na.gif',
   ' ',        ''
  );

sub no_print_page_foot
{
  my $fh = shift;
  print $fh <<EOT;
$PRE_BODY_CLOSE
</BODY>
</HTML>
EOT
}

$copying_comment          = \&my_copying_comment;
sub my_copying_comment($)
{
    return '';
}

# rewrite print_navigation to get rid of #SEC12 anchor references
# they cause page to be centered on navigation bar instead of top
sub my_strip_href($)
{
    my $x = shift;
    $x =~ s/#.*$//;
    return $x;
}

$print_navigation = \&my_print_navigation;

sub my_print_navigation($$$)
{
#    my $fh = shift;
    my $buttons = shift;
    my $vertical = shift;
    my $spacing = 1;
    my $result = '<table cellpadding="' . $spacing . '" cellspacing="' . $spacing . "\" border=\"0\"><tbody>\n";

    $result .= "<tr>" unless $vertical;
    for my $button (@$buttons)
    {
        $result .= qq{<tr valign="top" align="left">\n} if $vertical;
        $result .= qq{<td valign="middle" align="left">};

        if (ref($button) eq 'CODE')
        {
            &$button($fh, $vertical);
        }
        elsif (ref($button) eq 'SCALAR')
        {
            $result .= "$$button" if defined($$button);
        }
        elsif (ref($button) eq 'ARRAY')
        {
            my $text = $button->[1];
            my $button_href = $button->[0];
            if (defined($button_href) and !ref($button_href) 
               and defined($text) and (ref($text) eq 'SCALAR') and defined($$text))
            {             # use given text
		my $btn_hr = $Texi2HTML::HREF{$button_href};
                if ($btn_hr)
                {
                  $result .= "" .
                        &$anchor('',
                                    my_strip_href($btn_hr),
                                    $$text
                                   ) 
                                    ;
                }
                else
                {
                  $result .= $$text;
                }
            }
        }
        elsif ($button eq ' ')
        {                       # handle space button
            $result .=
                $ICONS && $ACTIVE_ICONS{' '} ?
                    &$button_icon_img($button, $ACTIVE_ICONS{' '}) :
                        $NAVIGATION_TEXT{' '};
            #next;
        }
        elsif ($Texi2HTML::HREF{$button})
        {                       # button is active
	    my $btn_hr = $Texi2HTML::HREF{$button};
            my $btitle = $BUTTONS_GOTO{$button} ?
                'title="' . ucfirst($BUTTONS_GOTO{$button}) . '"' : '';
            if ($ICONS && $ACTIVE_ICONS{$button})
            {                   # use icon
                $result .= '' .
                    &$anchor('',
                        my_strip_href($btn_hr),
                        &$button_icon_img($button,
                                   $ACTIVE_ICONS{$button},
                                   #$Texi2HTML::NAME{$button}),
                                   $Texi2HTML::NO_TEXI{$button}),
                        $btitle
                      );
            }
            else
            {                   # use text
                $result .=
                    '[' .
                        &$anchor('',
                                    my_strip_href($btn_hr),
                                    $NAVIGATION_TEXT{$button},
                                    $btitle
                                   ) .
                                       ']';
            }
        }
        else
        {                       # button is passive
            $result .=
                $ICONS && $PASSIVE_ICONS{$button} ?
                    &$button_icon_img($button,
                                          $PASSIVE_ICONS{$button},
                                          #$Texi2HTML::NAME{$button}) :
                                          $Texi2HTML::NO_TEXI{$button}) :

                                              "[" . $NAVIGATION_TEXT{$button} . "]";
        }
        $result .= "</td>\n";
        $result .= "</tr>\n" if $vertical;
    }
    $result .= "</tr>" unless $vertical;
    $result .= "</tbody></table>\n";
    return $result;
}

1;	# This must be the last non-comment line