]> git.donarmstrong.com Git - lilypond.git/blob - bin/make_website
release: 0.0.46.jcn1
[lilypond.git] / bin / make_website
1 #!/usr/bin/perl -w
2 # stuff should be generated in out directory.
3
4 sub
5         set_hrefs
6 {
7     while (<HTMLIN>) {
8         s#href=([A-Za-z.]+)#href=$base/$1#g;
9         print HTMLOUT $_;
10     }
11 }
12
13 sub all_refs
14 {
15     print "resetting refs.\n";
16
17     foreach $a (<*.html>)
18     {
19         rename $a, "$a~";
20         open HTMLIN, "$a~";
21         open HTMLOUT, ">$a";
22         set_hrefs;
23     }
24 }
25
26 local $base="lilypond/";
27 local @examples=("wohltemperirt" ,"standchen", "scsii-menuetto");
28
29 #mkdir "lilypond";
30 sub
31     gen_html
32 {
33     print "generating HTML";
34     foreach $a (<*.pod>) {
35         $f = $a;
36         $f =~ s/.pod/.html/;
37
38         system "pod2html $a"    if ( ! -f $f ) ;
39     }
40 }
41
42 sub
43     gen_examples
44 {
45     print "generating examples: ";
46     foreach $a (@examples) {
47         print "$a\n";
48         $texfile="test";
49         $tex = "tex $texfile";
50         if ($a eq "standchen" || $a eq "scsii-menuetto") {
51             $tex = "latex input/$a";
52             $texfile = "$a";
53         }
54         if ( ! -f "$a.ly.txt" ) {
55             system "ln ../input/$a.ly ./$a.ly.txt";
56         }
57         if ( ! -f "$a.ps.gz" ) {
58             system "cd ..; lilypond input/$a;$tex;".
59                 "dvips -o $a.ps $texfile;";
60         }
61         # generate the pixmap at twice the size, then rescale (for antialiasing)
62         if ( ! -f "$a.gif" ) {
63             system "mv ../$a.ps $a.ps; ".
64                 "mv ../lelie.midi ../$a.midi $a.midi; ".
65                     "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE  $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif";
66             system "gzip $a.ps";
67         }   
68     }
69 }
70
71
72 sub
73     gen_list
74 {
75     open HTMLLIST, ">example_output.html";
76     print HTMLLIST "<title>LilyPond examples</title>\n";
77     foreach $a (@examples) {
78         $name=$a;
79         print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
80         $cmd= "head ../input/$a.ly | grep \^% \| sed \"s/^%/    /\"";
81         $desc = `$cmd`;
82         print HTMLLIST "$desc\n</XMP>";
83
84         $inputf="$a.ly.txt";
85         $giff="$a.gif";
86         $psf="$a.ps.gz";
87         $midif="$a.midi";
88         
89         print HTMLLIST "<ul>
90 <li><a href=$inputf> The input file</a>
91 <li><a href=$giff>The output (gif)</a>
92 <li><a href=$psf>The output (PS)</a>
93 <li><a href=$midif>The output (MIDI)</a>
94 </ul>";
95     }
96 }
97 sub
98     copy_files
99 {  
100     print `ln -s ../out ./docxx` if ( ! -x "docxx" ) ;
101     system "cp ../TODO ./TODO.txt";
102     system "cp ../NEWS ./NEWS.txt";
103 }
104
105 sub
106     do_tar
107 {
108      system " tar hcf website.tar *.html *.gif lelie_logo.png *.ps.gz *.ly.txt *.midi docxx/*;" .
109     "gzip -f9 website.tar;" if ( ! -f "website.tar" ) ;
110 }
111
112 gen_html;
113 gen_examples;
114 gen_list;
115 copy_files;
116 do_tar;