| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# Format XHTML generated by groff -Thtml (via tidy) for websites |
| 4 |
# |
| 5 |
# Usage: groff -Thtml -P-l something.man | tidy -asxml ... | fix-groff-xhtml OUTPUT-FILE |
| 6 |
# |
| 7 |
# (C) Copyright 2003-2006 Dave Beckett |
| 8 |
# |
| 9 |
|
| 10 |
use strict; |
| 11 |
use File::Basename; |
| 12 |
|
| 13 |
my $progname=basename $0; |
| 14 |
|
| 15 |
my $raptor_title="Raptor RDF Parser Toolkit"; |
| 16 |
my $redland_title="Redland RDF Application Framework"; |
| 17 |
my $rasqal_title="Rasqal RDF Query Library"; |
| 18 |
|
| 19 |
die "USAGE: $progname OUTPUT-FILE\n" if @ARGV < 1; |
| 20 |
|
| 21 |
my $doc_title; |
| 22 |
|
| 23 |
my($file)=@ARGV; |
| 24 |
|
| 25 |
open(OUT, ">$file") or die "$progname: Cannot create $file - $!\n"; |
| 26 |
open(IN, "-"); |
| 27 |
while(<IN>) { |
| 28 |
|
| 29 |
s%<title>libraptor</title>%<title>$raptor_title - Raptor API</title>%; |
| 30 |
s%<h1 align="center">libraptor</h1>%<h1>$raptor_title - Raptor API</h1>%; |
| 31 |
|
| 32 |
s%<title>rapper</title>%<title>$raptor_title - Raptor RDF parser utility</title>%; |
| 33 |
s%<h1 align="center">rapper</h1>%<h1>$raptor_title - Raptor RDF parser utility</h1>%; |
| 34 |
|
| 35 |
s%<title>rdfproc</title>%<title>$redland_title - Redland RDF processor utility</title>%; |
| 36 |
s%<h1 align="center">rdfproc</h1>%<h1>$redland_title - Redland RDF processor utility</h1>%; |
| 37 |
|
| 38 |
s%<title>librasqal</title>%<title>$rasqal_title - Rasqal API</title>%; |
| 39 |
s%<h1 align="center">librasqal</h1>%<h1>$rasqal_title - Rasqal API</h1>%; |
| 40 |
|
| 41 |
s%<title>roqet</title>%<title>$rasqal_title - Rasqal RDF parser utility</title>%; |
| 42 |
s%<h1 align="center">roqet</h1>%<h1>$rasqal_title - Rasqal RDF parser utility</h1>%; |
| 43 |
|
| 44 |
next if /^<link|meta/i; |
| 45 |
|
| 46 |
s%^<body>%<body bgcolor="#ffffff" text="#000085">%; |
| 47 |
|
| 48 |
# This is not xhtml |
| 49 |
s% cols="\d+" % %; |
| 50 |
|
| 51 |
s%(name|id)="([^"]+)"%my($at,$val)=($1,$2); $val =~ s/ /_/g; qq{$at="$val"};%eg; |
| 52 |
|
| 53 |
s%(Dave Beckett|Institute for Learning and Research Technology .ILRT.|University of Bristol) (?:- |)(http://[^<]+)%<a href="$2">$1</a>%; |
| 54 |
|
| 55 |
my $year=1900+(localtime)[5]; |
| 56 |
print OUT <<"EOT" if m%^</body>%; |
| 57 |
|
| 58 |
<p>Copyright 2002-$year <a href="http://purl.org/net/dajobe/">Dave Beckett</a><br />2002-$year <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 59 |
|
| 60 |
EOT |
| 61 |
print OUT; |
| 62 |
} |
| 63 |
close(IN); |
| 64 |
close(OUT); |