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