From: Michal Vaner Date: Sun, 7 Sep 2008 14:29:44 +0000 (+0200) Subject: Doc. system: definition list formatter X-Git-Tag: holmes-import~335 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=da9a858ab511e19ca761dd27b60ba6b7294c25c7;p=libucw.git Doc. system: definition list formatter --- diff --git a/build/def-doc.pl b/build/def-doc.pl new file mode 100755 index 00000000..d316a56d --- /dev/null +++ b/build/def-doc.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# Script for formatting documentation from definition lists +# (they get out of extract-doc.pl as a side-product). +# (c) 2008 Michal Vaner +use strict; +use warnings; + +my $head = shift; +my $out = shift; + +open OUT, ">$out" or die "Could not write output $out ($!)\n"; +open HEAD, $head or die "Could not open head $head ($!)\n"; +print OUT foreach( ); +close HEAD; + +my $dir = $out; +$dir =~ s/\/[^\/]+$//; + +while( defined( my $line = <> ) ) { + chomp $line; + my( $file, $num, $text ) = split /,/, $line, 3; + my $dircp = $dir; + while( shift @{[ $dircp =~ /([^\/]+)/, "//" ]} eq shift @{[ $file =~ /([^\/]+)/, "///" ]} ) { + $dircp =~ s/[^\/]+\/?//; + $file =~ s/[^\/]+\/?//; + } + $dircp =~ s/[^\/]+/../g; + $file = $dircp."/".$file; + $file =~ s/^\///; + $file =~ s/\.[^.]+$//; + print OUT "- <<$file:auto_$num,`$text`>>\n"; +} + +close OUT;