[svn:parrot] r45489 - in trunk: docs tools/docs
gerd at svn.parrot.org
gerd at svn.parrot.org
Fri Apr 9 23:53:57 UTC 2010
Author: gerd
Date: Fri Apr 9 23:53:57 2010
New Revision: 45489
URL: https://trac.parrot.org/parrot/changeset/45489
Log:
Initial work to generate a PDF file as Parrot book from POD files. The first version has only two chapters from two POD files. It works not on Windows because it use "sed".
Added:
trunk/docs/Makefile.pdf
trunk/tools/docs/book-to-latex.pl
trunk/tools/docs/filename_and_chapter.pl
Added: trunk/docs/Makefile.pdf
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/docs/Makefile.pdf Fri Apr 9 23:53:57 2010 (r45489)
@@ -0,0 +1,28 @@
+#
+# This makefile is to generate a parrot PDF document. You can use it with:
+# > make -f Makefile.pdf
+# > make -f Makefile.pdf <target>
+# It will not work on Windows. It call a script which use a specific Unix
+# command. May be that will be changed.
+#
+PERL = /usr/bin/perl
+MKPATH = $(PERL) -MExtUtils::Command -e mkpath
+CHAPTERS = $(shell $(PERL) ../tools/docs/filename_and_chapter.pl --print)
+M_CHAPTERS = $(shell $(PERL) ../tools/docs/filename_and_chapter.pl --b_out)
+
+
+default: build/parrot-book.pdf
+
+release: build/parrot-book.pdf
+ cp build/parrot-book.pdf build/parrot-book-$$(date +"%Y.%m").pdf
+
+build/parrot-book.pdf: $(CHAPTERS) ../tools/docs/book-to-latex.pl
+ $(MKPATH) build/modified_pod
+ $(PERL) ../tools/docs/filename_and_chapter.pl
+ $(PERL) ../tools/docs/book-to-latex.pl $(M_CHAPTERS) > build/parrot-book.tex
+ cd build && pdflatex parrot-book.tex && pdflatex parrot-book.tex
+
+clean:
+ rm -rf build
+
+# vim: set noexpandtab
Added: trunk/tools/docs/book-to-latex.pl
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/docs/book-to-latex.pl Fri Apr 9 23:53:57 2010 (r45489)
@@ -0,0 +1,22 @@
+#!perl -w
+use strict;
+use Pod::PseudoPod::LaTeX;
+
+print <<'HEADER';
+\documentclass[11pt,a4paper,oneside]{report}
+\usepackage{graphics,graphicx}
+\usepackage{colortbl}
+
+\begin{document}
+\tableofcontents
+HEADER
+
+for (@ARGV) {
+ my $parser = Pod::PseudoPod::LaTeX->new();
+ $parser->output_fh( *STDOUT );
+ $parser->parse_file( $_ );
+}
+
+print <<'FOOTER';
+\end{document}
+FOOTER
Added: trunk/tools/docs/filename_and_chapter.pl
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/docs/filename_and_chapter.pl Fri Apr 9 23:53:57 2010 (r45489)
@@ -0,0 +1,37 @@
+#!perl -w
+# perl script that deliver all filenames and the associated chapters
+#
+
+use Getopt::Long ();
+
+my $item_list_ref = [ ['intro.pod', 'Introduction to Parrot'],
+ ['overview.pod', 'Overview'],
+ ];
+
+my $lang = @$item_list_ref;
+
+my ( $result, $give_out, $b_out);
+
+$result = Getopt::Long::GetOptions (
+ "print" => \$give_out,
+ "b_out" => \$b_out,
+);
+
+if ($give_out) {
+ for ( my $i=0; $i<$lang; $i++ )
+ { print $$item_list_ref[$i][0], ' ' }
+ exit;
+};
+
+if ($b_out) {
+ for ( my $i=0; $i<$lang; $i++ )
+ { print 'build/modified_pod/', $$item_list_ref[$i][0], ' ' }
+ exit;
+};
+
+
+for (my $i=0; $i<$lang; $i++)
+ { `sed -e '4,6c\=head0 $$item_list_ref[$i][1]' $$item_list_ref[$i][0] > build/modified_pod/$$item_list_ref[$i][0]` }
+
+
+
More information about the parrot-commits
mailing list