1 # makeinfo HTML output init file
3 # Copyright (c) 2011, 2012 Free Software Foundation, Inc.
4 # Copyright (c) 2014 Andreas Cadhalpun
5 # Copyright (c) 2014 Tiancheng "Timothy" Gu
7 # This file is part of FFmpeg.
9 # FFmpeg is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # FFmpeg is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public
20 # License along with FFmpeg; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # no navigation elements
24 set_from_init_file('HEADERS', 0);
26 # TOC and Chapter headings link
27 set_from_init_file('TOC_LINKS', 1);
29 # print the TOC where @contents is used
30 set_from_init_file('INLINE_CONTENTS', 1);
33 set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
36 set_from_init_file('DEFAULT_RULE', '');
37 set_from_init_file('BIG_RULE', '');
39 # Customized file beginning
40 sub ffmpeg_begin_file($$$)
47 if ($element and $self->get_conf('SPLIT')) {
48 $command = $self->element_command($element);
51 my ($title, $description, $encoding, $date, $css_lines,
52 $doctype, $bodytext, $copying_comment, $after_body_open,
53 $extra_head, $program_and_version, $program_homepage,
54 $program, $generator) = $self->_file_header_informations($command);
56 my $links = $self->_get_links ($filename, $element);
58 my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
59 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
61 <!-- Created by $program_and_version, $program_homepage -->
63 <meta charset="utf-8">
66 my $head_title = <<EOT;
70 my $head2 = $ENV{"FFMPEG_HEADER2"} || <<EOT;
72 <link rel="stylesheet" type="text/css" href="bootstrap.min.css">
73 <link rel="stylesheet" type="text/css" href="style.min.css">
76 <div style="width: 95%; margin: auto">
80 my $head3 = $ENV{"FFMPEG_HEADER3"} || <<EOT;
84 return $head1 . $head_title . $head2 . $head_title . $head3;
86 texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
88 # Customized file ending
89 sub ffmpeg_end_file($)
92 my $program_string = &{$self->{'format_program_string'}}($self);
93 my $program_text = <<EOT;
94 <p style="font-size: small;">
98 my $footer = $ENV{FFMPEG_FOOTER} || <<EOT;
103 return $program_text . $footer;
105 texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
107 # Dummy title command
108 # Ignore title. Title is handled through ffmpeg_begin_file().
109 set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
110 sub ffmpeg_title($$$$)
115 texinfo_register_command_formatting('titlefont',
118 # Customized float command. Part of code borrowed from GNU Texinfo.
119 sub ffmpeg_float($$$$$)
127 my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
129 my $caption_text = '';
131 my $prepended_save = '';
133 if ($self->in_string()) {
135 $prepended_text = $self->convert_tree_new_formatting_context(
136 $prepended, 'float prepended');
138 $prepended_text = '';
141 $caption_text = $self->convert_tree_new_formatting_context(
142 {'contents' => $caption->{'args'}->[0]->{'contents'}},
145 return $prepended.$content.$caption_text;
148 my $id = $self->command_id($command);
150 if (defined($id) and $id ne '') {
151 $label = "<a name=\"$id\"></a>";
158 # prepend the prepended tree to the first paragraph
159 my @caption_original_contents = @{$caption->{'args'}->[0]->{'contents'}};
160 my @caption_contents;
162 while (@caption_original_contents) {
163 my $content = shift @caption_original_contents;
164 if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
165 %{$new_paragraph} = %{$content};
166 $new_paragraph->{'contents'} = [@{$content->{'contents'}}];
167 unshift (@{$new_paragraph->{'contents'}}, {'cmdname' => 'strong',
168 'args' => [{'type' => 'brace_command_arg',
169 'contents' => [$prepended]}]});
170 push @caption_contents, $new_paragraph;
173 push @caption_contents, $content;
176 push @caption_contents, @caption_original_contents;
177 if ($new_paragraph) {
178 $caption_text = $self->convert_tree_new_formatting_context(
179 {'contents' => \@caption_contents}, 'float caption');
180 $prepended_text = '';
183 if ($caption_text eq '') {
184 $prepended_text = $self->convert_tree_new_formatting_context(
185 $prepended, 'float prepended');
186 if ($prepended_text ne '') {
187 $prepended_save = $prepended_text;
188 $prepended_text = '<p><strong>'.$prepended_text.'</strong></p>';
192 $prepended_text = '';
195 if ($caption and $caption_text eq '') {
196 $caption_text = $self->convert_tree_new_formatting_context(
197 $caption->{'args'}->[0], 'float caption');
199 if ($prepended_text.$caption_text ne '') {
200 $prepended_text = $self->_attribute_class('div','float-caption'). '>'
202 $caption_text .= '</div>';
205 if ($prepended_save =~ /NOTE/) {
206 $html_class = 'info';
207 $prepended_text = '';
209 } elsif ($prepended_save =~ /IMPORTANT/) {
210 $html_class = 'warning';
211 $prepended_text = '';
214 return $self->_attribute_class('div', $html_class). '>' . "\n" .
215 $prepended_text . $caption_text . $content . '</div>';
218 texinfo_register_command_formatting('float',