diff options
author | Dave Beckett <dave@dajobe.org> | 2003-03-31 17:07:59 +0000 |
---|---|---|
committer | Dave Beckett <dave@dajobe.org> | 2003-03-31 17:07:59 +0000 |
commit | 60f06e5e14396d9a0987a653be6d26f229389fee (patch) | |
tree | 80301aceb341b21e83bb269c8c184c9592fd5a9d | |
parent | 6405b703ece304f37f87cea69813d70b36a871c7 (diff) | |
download | raptor-60f06e5e14396d9a0987a653be6d26f229389fee.tar.gz |
Fix groff output HTML
-rwxr-xr-x | fix-groff-xhtml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fix-groff-xhtml b/fix-groff-xhtml new file mode 100755 index 00000000..e24ca22f --- /dev/null +++ b/fix-groff-xhtml @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# +# $Id$ +# +# Format XHTML generated by groff -Thtml (via tidy) for websites +# +# Usage: groff -Thtml -P-l something.man | tidy -asxml ... | fix-groff-xhtml OUTPUT-FILE +# +# (C) Copyright 2003 Dave Beckett <Dave.Beckett@bristol.ac.uk> +# University of Bristol +# + +use strict; +use File::Basename; + +my $progname=basename $0; + +my $main_title="Raptor RDF Parser Toolkit"; + +die "USAGE: $progname OUTPUT-FILE\n" if @ARGV < 1; + +my $doc_title; + +my($file)=@ARGV; + +open(OUT, ">$file") or die "$progname: Cannot create $file - $!\n"; +open(IN, "-"); +while(<IN>) { + + s%<title>libraptor</title>%<title>$main_title - Raptor API</title>%; + s%<h1 align="center">libraptor</h1>%<h1 align="center">$main_title - Raptor API</h1>%; + + next if /^<link|meta/i; + + s%^<body>%<body bgcolor="#ffffff" text="#000085">%; + + # This is not xhtml + s% cols="2" % %; + + s%(name|id)="([^"]+)"%my($at,$val)=($1,$2); $val =~ s/ /_/g; qq{$at="$val"};%eg; + + my $year=1900+(localtime)[5]; + print OUT <<"EOT" if m%^</body>%; + +<p>Copyright 2002-$year <a href="http://purl.org/net/dajobe/">Dave Beckett</a>, <a href="http://www.ilrt.bristol.ac.uk/">Institute for Learning and Research Technology</a>, <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> + +EOT + print OUT; +} +close(IN); +close(OUT); |