aboutsummaryrefslogtreecommitdiff
path: root/web/mkdemos.pl
blob: 02e5da2f69f0cb89834b46faba38198c2f80028a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w
# first argument is input filename - a demo template.
# second argument is output filename.

my $infile=$ARGV[0];
my $outfile=$ARGV[1];

open( IN, "< $infile" );
open( OUT, "> $outfile" );

while (<IN>) {

    my $line = $_;
    my $firstchar = substr ($line,0,1);
    if ( $firstchar eq '@' ) {
        my $command = substr ($line,4);
        print STDERR "$command";
        system "$command";
        $line = $command;
        $line =~ s/-/\-/;
        $line =~ s/ ([A-Za-z0-9_:\/]+(\.|\/)[a-zA-Z0-9.\/]*|README|S5DEMO)/ <a href="$1">$1<\/a>/g;
        $line =~ s/-/\\-/g;
        $line =~ s/^(.*)$/    <code>$1<\/code>/g;        
    }
    print OUT $line;

}