| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# Format XHTML generated by rdoc (via tidy) for websites |
| 4 |
# |
| 5 |
# Usage: rdoc .... |
| 6 |
# for f in `find outdir -name \*.html -print`; |
| 7 |
# tidy ... $f | fix-rdoc-xhtml $f.new && mv $f.new $f; |
| 8 |
# donek OUTPUT-FILE |
| 9 |
# |
| 10 |
# Copyright (C) 2001-2005 David Beckett - http://www.dajobe.org/ |
| 11 |
# Copyright (C) 2001-2005 University of Bristol - http://www.bristol.ac.uk/ |
| 12 |
# |
| 13 |
|
| 14 |
use strict; |
| 15 |
use File::Basename; |
| 16 |
|
| 17 |
my $progname=basename $0; |
| 18 |
|
| 19 |
my $main_title="Redland RDF Language Bindings - Ruby RDoc"; |
| 20 |
|
| 21 |
die "USAGE: $progname OUTPUT-FILE\n" if @ARGV < 1; |
| 22 |
|
| 23 |
my($file)=@ARGV; |
| 24 |
|
| 25 |
my $is_index = ($file =~ /(fr_file_index|fr_class_index|fr_method_index)/); |
| 26 |
|
| 27 |
open(OUT, ">$file") or die "$progname: Cannot create $file - $!\n"; |
| 28 |
open(IN, "-"); |
| 29 |
while(<IN>) { |
| 30 |
|
| 31 |
if(m%<title>(.*?)</title>%) { |
| 32 |
s%<title>(.*?)</title>%<title>$main_title - $1</title>%; |
| 33 |
} |
| 34 |
|
| 35 |
if(m%<body>%) { |
| 36 |
print OUT; |
| 37 |
print OUT <<"EOT" if !$is_index; |
| 38 |
<div class="outerBlock"> |
| 39 |
|
| 40 |
<div class="outerHeader"> |
| 41 |
Go to <a href="/" target="_parent">Redland Home</a> - |
| 42 |
<a href="/bindings/" target="_parent">Language Bindings Home</a> - |
| 43 |
<a href="/docs/ruby.html" target="_parent">Ruby API Home</a> |
| 44 |
</div> |
| 45 |
|
| 46 |
EOT |
| 47 |
next; |
| 48 |
} |
| 49 |
|
| 50 |
next if /^<meta/i; |
| 51 |
|
| 52 |
if(m%<link%) { |
| 53 |
# $_=qq{<link rel="stylesheet" href="/docs/rdoc/rdoc.css" type="text/css" media="screen" />\n}; |
| 54 |
} |
| 55 |
|
| 56 |
if(m%"validator-badges"%) { |
| 57 |
while(<IN>) { |
| 58 |
last if m%</div>%; |
| 59 |
} |
| 60 |
next; |
| 61 |
} |
| 62 |
|
| 63 |
my $year=1900+(localtime)[5]; |
| 64 |
if(m%^</body>%) { |
| 65 |
print OUT <<"EOT"; |
| 66 |
<hr /> |
| 67 |
|
| 68 |
EOT |
| 69 |
|
| 70 |
print OUT <<"EOT" if !$is_index; |
| 71 |
<div class="outerHeader"> |
| 72 |
Go to <a href="/" target="_parent">Redland Home</a> - |
| 73 |
<a href="/bindings/" target="_parent">Language Bindings Home</a> - |
| 74 |
<a href="/docs/ruby.html" target="_parent">Ruby API Home</a> |
| 75 |
</div> |
| 76 |
|
| 77 |
EOT |
| 78 |
|
| 79 |
print OUT <<"EOT"; |
| 80 |
<p>(C) Copyright 2004-$year <a href="http://www.dajobe.org/" target="_parent">Dave Beckett</a>, (C) Copyright 2004-2005 <a href="http://www.bristol.ac.uk/" target="_parent">University of Bristol</a></p> |
| 81 |
|
| 82 |
</div> <!-- end outerBlock --> |
| 83 |
|
| 84 |
EOT |
| 85 |
} |
| 86 |
|
| 87 |
print OUT; |
| 88 |
} |
| 89 |
close(IN); |
| 90 |
close(OUT); |