ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/doc/genpdf
Revision: 1.6
Committed: Sun Sep 16 18:54:41 2007 UTC (19 years ago) by pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +2 -2 lines
Log Message:
#defines to enum

File Contents

# User Rev Content
1 pippijn 1.1 #!/usr/bin/env perl
2    
3     use strict;
4     use warnings;
5     use utf8;
6    
7 pippijn 1.6 use constant rcsid => '$Id: genpdf,v 1.5 2007-08-28 17:08:06 pippijn Exp $';
8 pippijn 1.2
9 pippijn 1.1 BEGIN {
10     unshift @INC, "lib";
11     }
12    
13     use Pod::POM;
14    
15     use LaTeX;
16    
17     my $parser = new Pod::POM;
18     my $current;
19    
20     my @podfiles = <podhelp/*.pod>;
21    
22     sub latexise {
23     my ($data) = @_;
24     my $name = $current;
25     $name =~ s/serv/Serv/;
26     $name = ucfirst $name;
27     $$data =~ s/&nick&/$name/g;
28    
29 pippijn 1.5 $$data =~ s/~/\$\\sim\$/g;
30 pippijn 1.1 $$data =~ s/#/\\#/g;
31 pippijn 1.5 $$data =~ s/%/\\%/g;
32     $$data =~ s/&/\\&/g;
33 pippijn 1.1 $$data =~ s/_/\\_/g;
34 pippijn 1.3 $$data =~ s/</\\textless{}/g;
35     $$data =~ s/>/\\textgreater{}/g;
36 pippijn 1.1 $$data =~ s/\|/\$|\$/g;
37    
38     $$data
39     }
40    
41     sub delatexise {
42     my ($data) = @_;
43     my $result = "";
44     for (split /\n/, $$data) {
45     if (/^ /) {
46 pippijn 1.5 $_ =~ s/\$\\sim\$/~/g;
47 pippijn 1.1 $_ =~ s/\\#/#/g;
48 pippijn 1.5 $_ =~ s/\\%/%/g;
49     $_ =~ s/\\&/&/g;
50 pippijn 1.1 $_ =~ s/\\_/_/g;
51 pippijn 1.3 $_ =~ s/\\textless\{\}/</g;
52     $_ =~ s/\\textgreater\{\}/>/g;
53 pippijn 1.1 $_ =~ s/\$\|\$/|/g;
54     }
55     $result .= "$_\n";
56     }
57    
58     $$data = $result
59     }
60    
61     mkdir "latex";
62     mkdir "latex/podhelp";
63     mkdir "latex/poddoc";
64    
65     for my $file (@podfiles) {
66     ($current) = $file =~ /podhelp\/(.+)\.pod$/;
67     my $data = do { local $/; open my $fh, "<$file" or die "$file: $!"; <$fh> };
68 pippijn 1.5 $data .= "\n" . do { local $/; open my $fh, "<podmisc/help.pod" or die "podmisc/help.pod: $!"; <$fh> };
69 pippijn 1.1 my $pom = $parser->parse_text ($data)
70     or die $parser->error();
71     open my $fh, ">latex/podhelp/$current.tex";
72     print $fh $pom->present ("LaTeX::Help");
73     close $fh;
74     }
75    
76     @podfiles = <poddoc/*.pod>;
77    
78     for my $file (@podfiles) {
79     ($current) = $file =~ /poddoc\/(.+)\.pod$/;
80     my $data = do { local $/; open my $fh, "<$file" or die "$file: $!"; <$fh> };
81     my $pom = $parser->parse_text ($data)
82     or die $parser->error();
83     open my $fh, ">latex/poddoc/$current.tex";
84     print $fh $pom->present ("LaTeX::Doc");
85     close $fh;
86     }
87    
88     @podfiles = <podsvs/*.pod>;
89    
90     for my $file (@podfiles) {
91     ($current) = $file =~ /podsvs\/(.+)\.pod$/;
92     my $data = do { local $/; open my $fh, "<$file" or die "$file: $!"; <$fh> };
93     my $pom = $parser->parse_text ($data)
94     or die $parser->error();
95     open my $fh, ">latex/poddoc/$current.tex";
96     print $fh $pom->present ("LaTeX::Doc");
97     close $fh;
98     }
99 pippijn 1.4
100     =head1 AUTHOR
101    
102     Copyright © 2007 Pippijn van Steenhoven
103    
104     =head1 LICENSE
105    
106     This library is free software, you can redistribute it and/or modify
107 pippijn 1.6 it under the terms of the GNU General Public License as documented in COPYING.
108 pippijn 1.4
109     =cut