[FFmpeg-cvslog] Use makeinfo to generate html doc for the new website

Timothy Gu git at videolan.org
Thu Sep 4 02:58:29 CEST 2014


ffmpeg | branch: master | Timothy Gu <timothygu99 at gmail.com> | Sun Aug 31 19:39:35 2014 -0700| [17ad5fbb8af3ea3fad689064bc84ecfdfe52f0c2] | committer: Michael Niedermayer

Use makeinfo to generate html doc for the new website

texi2html is deprecated by upstream in favor of makeinfo/texi2any. See:

- https://www.gnu.org/software/texinfo/manual/texinfo/html_node/texi2html.html
- https://wiki.debian.org/Texi2htmlTransition
- https://lists.debian.org/debian-devel/2013/05/msg01516.html

This is actually two separate changes.

Based on a patch by Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>.

Fixes Trac ticket #3232.

Signed-off-by: Timothy Gu <timothygu99 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17ad5fbb8af3ea3fad689064bc84ecfdfe52f0c2
---

 Changelog         |    1 +
 RELEASE_NOTES     |    2 +
 configure         |   10 ++-
 doc/Makefile      |   13 +++-
 doc/platform.texi |    2 +-
 doc/t2h.init      |    4 +
 doc/t2h.pm        |  220 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 248 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index 274a811..0bcf99c 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@ version <next>:
 - HEVC/H.265 RTP payload format (draft v6) depacketizer
 - added codecview filter to visualize information exported by some codecs
 - matroska 3d support thorugh side data
+- HTML generation using texi2html is deprecated in favor of makeinfo/texi2any
 
 
 version 2.3:
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 87a0053..c6e27d1 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -52,3 +52,5 @@
   • dctdnoiz filter now uses a block size of 8x8 instead of 16x16 by default
   • -vismv option is deprecated in favor of the codecview filter
   • libmodplug is now detected through pkg-config
+  • HTML documentation generation through texi2html is deprecated in
+    favor of makeinfo/texi2any
diff --git a/configure b/configure
index b1814db..c2363c9 100755
--- a/configure
+++ b/configure
@@ -1802,6 +1802,7 @@ HAVE_LIST="
     libdc1394_1
     libdc1394_2
     makeinfo
+    makeinfo_html
     perl
     pod2man
     sdl
@@ -2631,7 +2632,8 @@ ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
 # documentation
 podpages_deps="perl"
 manpages_deps="perl pod2man"
-htmlpages_deps="perl texi2html"
+htmlpages_deps="perl"
+htmlpages_deps_any="makeinfo_html texi2html"
 txtpages_deps="perl makeinfo"
 doc_deps_any="manpages htmlpages podpages txtpages"
 
@@ -4916,8 +4918,11 @@ else
 fi
 enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
 
-texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
 makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
+enabled makeinfo && (makeinfo --version | \
+                     grep -q 'makeinfo (GNU texinfo) 5' > /dev/null 2>&1) \
+    && enable makeinfo_html || disable makeinfo_html
+disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
 perl -v            > /dev/null 2>&1 && enable perl      || disable perl
 pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
 rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
@@ -5401,6 +5406,7 @@ echo "texi2html enabled         ${texi2html-no}"
 echo "perl enabled              ${perl-no}"
 echo "pod2man enabled           ${pod2man-no}"
 echo "makeinfo enabled          ${makeinfo-no}"
+echo "makeinfo supports HTML    ${makeinfo_html-no}"
 test -n "$random_seed" &&
     echo "random seed               ${random_seed}"
 echo
diff --git a/doc/Makefile b/doc/Makefile
index 6f2812d..2502922 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -82,14 +82,25 @@ $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
 	$(M)doc/print_options $* > $@
 
 doc/%.html: TAG = HTML
+doc/%-all.html: TAG = HTML
+
+ifdef HAVE_MAKEINFO_HTML
+doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
+	$(Q)$(TEXIDEP)
+	$(M)makeinfo --html -I doc --no-split -D config-not-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
+
+doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.pm $(GENTEXI)
+	$(Q)$(TEXIDEP)
+	$(M)makeinfo --html -I doc --no-split -D config-all --init-file=$(SRC_PATH)/doc/t2h.pm --output $@ $<
+else
 doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
 	$(Q)$(TEXIDEP)
 	$(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
 
-doc/%-all.html: TAG = HTML
 doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
 	$(Q)$(TEXIDEP)
 	$(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
+endif
 
 doc/%.pod: TAG = POD
 doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
diff --git a/doc/platform.texi b/doc/platform.texi
index fb08a1e..ca76492 100644
--- a/doc/platform.texi
+++ b/doc/platform.texi
@@ -278,7 +278,7 @@ llrint() in its C library.
 Install your Cygwin with all the "Base" packages, plus the
 following "Devel" ones:
 @example
-binutils, gcc4-core, make, git, mingw-runtime, texi2html
+binutils, gcc4-core, make, git, mingw-runtime, texinfo
 @end example
 
 In order to run FATE you will also need the following "Utils" packages:
diff --git a/doc/t2h.init b/doc/t2h.init
index 9dd8f91..82db84f 100644
--- a/doc/t2h.init
+++ b/doc/t2h.init
@@ -1,3 +1,7 @@
+# Init file for texi2html.
+
+# This is deprecated, and the makeinfo/texi2any version is doc/t2h.pm
+
 # no horiz rules between sections
 $end_section = \&FFmpeg_end_section;
 sub FFmpeg_end_section($$)
diff --git a/doc/t2h.pm b/doc/t2h.pm
new file mode 100644
index 0000000..b647b68
--- /dev/null
+++ b/doc/t2h.pm
@@ -0,0 +1,220 @@
+# makeinfo HTML output init file
+#
+# Copyright (c) 2011, 2012 Free Software Foundation, Inc.
+# Copyright (c) 2014 Andreas Cadhalpun
+# Copyright (c) 2014 Tiancheng "Timothy" Gu
+#
+# This file is part of FFmpeg.
+#
+# FFmpeg is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# FFmpeg is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with FFmpeg; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# no navigation elements
+set_from_init_file('HEADERS', 0);
+
+# TOC and Chapter headings link
+set_from_init_file('TOC_LINKS', 1);
+
+# print the TOC where @contents is used
+set_from_init_file('INLINE_CONTENTS', 1);
+
+# make chapters <h2>
+set_from_init_file('CHAPTER_HEADER_LEVEL', 2);
+
+# Do not add <hr>
+set_from_init_file('DEFAULT_RULE', '');
+set_from_init_file('BIG_RULE', '');
+
+# Customized file beginning
+sub ffmpeg_begin_file($$$)
+{
+    my $self = shift;
+    my $filename = shift;
+    my $element = shift;
+
+    my $command;
+    if ($element and $self->get_conf('SPLIT')) {
+        $command = $self->element_command($element);
+    }
+
+    my ($title, $description, $encoding, $date, $css_lines,
+        $doctype, $bodytext, $copying_comment, $after_body_open,
+        $extra_head, $program_and_version, $program_homepage,
+        $program, $generator) = $self->_file_header_informations($command);
+
+    my $links = $self->_get_links ($filename, $element);
+
+    my $head1 = $ENV{"FFMPEG_HEADER1"} || <<EOT;
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Created by $program_and_version, $program_homepage -->
+  <head>
+    <meta charset="utf-8">
+    <title>
+EOT
+    my $head_title = <<EOT;
+      $title
+EOT
+
+    my $head2 = $ENV{"FFMPEG_HEADER2"} || <<EOT;
+    </title>
+    <link rel="stylesheet" type="text/css" href="style.min.css">
+  </head>
+  <body>
+    <div style="width: 95%; margin: auto">
+      <h1>
+EOT
+
+    my $head3 = $ENV{"FFMPEG_HEADER3"} || <<EOT;
+      </h1>
+EOT
+
+    return $head1 . $head_title . $head2 . $head_title . $head3;
+}
+texinfo_register_formatting_function('begin_file', \&ffmpeg_begin_file);
+
+# Customized file ending
+sub ffmpeg_end_file($)
+{
+    my $self = shift;
+    my $program_string = &{$self->{'format_program_string'}}($self);
+    my $program_text = <<EOT;
+      <p style="font-size: small;">
+        $program_string
+      </p>
+EOT
+    my $footer = $ENV{FFMPEG_FOOTER} || <<EOT;
+    </div>
+  </body>
+</html>
+EOT
+    return $program_text . $footer;
+}
+texinfo_register_formatting_function('end_file', \&ffmpeg_end_file);
+
+# Dummy title command
+# Ignore title. Title is handled through ffmpeg_begin_file().
+set_from_init_file('USE_TITLEPAGE_FOR_TITLE', 1);
+sub ffmpeg_title($$$$)
+{
+    return '';
+}
+
+texinfo_register_command_formatting('titlefont',
+                                    \&ffmpeg_title);
+
+# Customized float command. Part of code borrowed from GNU Texinfo.
+sub ffmpeg_float($$$$$)
+{
+    my $self = shift;
+    my $cmdname = shift;
+    my $command = shift;
+    my $args = shift;
+    my $content = shift;
+
+    my ($caption, $prepended) = Texinfo::Common::float_name_caption($self,
+                                                                $command);
+    my $caption_text = '';
+    my $prepended_text;
+    my $prepended_save = '';
+
+    if ($self->in_string()) {
+        if ($prepended) {
+            $prepended_text = $self->convert_tree_new_formatting_context(
+                $prepended, 'float prepended');
+        } else {
+            $prepended_text = '';
+        }
+        if ($caption) {
+            $caption_text = $self->convert_tree_new_formatting_context(
+                {'contents' => $caption->{'args'}->[0]->{'contents'}},
+                'float caption');
+        }
+        return $prepended.$content.$caption_text;
+    }
+
+    my $id = $self->command_id($command);
+    my $label;
+    if (defined($id) and $id ne '') {
+        $label = "<a name=\"$id\"></a>";
+    } else {
+        $label = '';
+    }
+
+    if ($prepended) {
+        if ($caption) {
+            # prepend the prepended tree to the first paragraph
+            my @caption_original_contents = @{$caption->{'args'}->[0]->{'contents'}};
+            my @caption_contents;
+            my $new_paragraph;
+            while (@caption_original_contents) {
+                my $content = shift @caption_original_contents;
+                if ($content->{'type'} and $content->{'type'} eq 'paragraph') {
+                    %{$new_paragraph} = %{$content};
+                    $new_paragraph->{'contents'} = [@{$content->{'contents'}}];
+                    unshift (@{$new_paragraph->{'contents'}}, {'cmdname' => 'strong',
+                             'args' => [{'type' => 'brace_command_arg',
+                                                    'contents' => [$prepended]}]});
+                    push @caption_contents, $new_paragraph;
+                    last;
+                } else {
+                    push @caption_contents, $content;
+                }
+            }
+            push @caption_contents, @caption_original_contents;
+            if ($new_paragraph) {
+                $caption_text = $self->convert_tree_new_formatting_context(
+                 {'contents' => \@caption_contents}, 'float caption');
+                $prepended_text = '';
+            }
+        }
+        if ($caption_text eq '') {
+            $prepended_text = $self->convert_tree_new_formatting_context(
+                $prepended, 'float prepended');
+            if ($prepended_text ne '') {
+                $prepended_save = $prepended_text;
+                $prepended_text = '<p><strong>'.$prepended_text.'</strong></p>';
+            }
+        }
+    } else {
+        $prepended_text = '';
+    }
+
+    if ($caption and $caption_text eq '') {
+        $caption_text = $self->convert_tree_new_formatting_context(
+            $caption->{'args'}->[0], 'float caption');
+    }
+    if ($prepended_text.$caption_text ne '') {
+        $prepended_text = $self->_attribute_class('div','float-caption'). '>'
+                . $prepended_text;
+        $caption_text .= '</div>';
+    }
+    my $html_class = '';
+    if ($prepended_save =~ /NOTE/) {
+        $html_class = 'info';
+        $prepended_text = '';
+        $caption_text   = '';
+    } elsif ($prepended_save =~ /IMPORTANT/) {
+        $html_class = 'warning';
+        $prepended_text = '';
+        $caption_text   = '';
+    }
+    return $self->_attribute_class('div', $html_class). '>' . "\n" .
+        $prepended_text . $caption_text . $content . '</div>';
+}
+
+texinfo_register_command_formatting('float',
+                                    \&ffmpeg_float);
+
+1;



More information about the ffmpeg-cvslog mailing list