3 ($#ARGV >= 2) or die "Usage: index_php.pl <input-php.in-file> <input-html-file> <output-php-file>";
6 my($level,$label,$name);
16 while(defined($line=<FILE>)) {
17 if($line =~/<div class="tabs">/) {
19 while(defined($line=<FILE>) && !($line =~/<\/div>/)) {
23 $onglets.="<center></center><p><br>\n"
25 if($line =~/<!-- ______BODY_BEGIN______ --!>(.*)$/) {
27 if($tmp =~/(.*)<!-- ______BODY_END______ --!>/) {
31 while(defined($line=<FILE>) && !($line =~/<!-- ______BODY_END______ --!>/)) {
34 $line =~/^(.*)<!-- ______BODY_END______ --!>/;
41 # (?!http) : A zero-width negative look-ahead assertion.
42 # For example "/foo(?!bar)/" matches any occurrence of "foo" that isn’t followed by "bar".
44 $onglets =~ s/href=\"(?!http)/href=\"doc\//gi;
45 $onglets =~ s/src=\"(?!http)/src=\"doc\//gi;
47 $body =~ s/href=\"(?!http)/href=\"doc\//gi;
48 $body =~ s/src=\"(?!http)/src=\"doc\//gi;
51 open OUTPUT,"> $output";
53 while(defined($line=<FILE>)) {
55 if($line =~/______ONGLETS______/) {
56 $line =~ s/______ONGLETS______/$onglets/g;
57 } elsif($line =~/______BODY______/) {
58 $line =~ s/______BODY______/$body/g;
60 print OUTPUT "$line\n";