From da9a858ab511e19ca761dd27b60ba6b7294c25c7 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Sun, 7 Sep 2008 16:29:44 +0200 Subject: [PATCH] Doc. system: definition list formatter --- build/def-doc.pl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 build/def-doc.pl 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; -- 2.39.2