X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=doclib%2Ffilter.pl;h=14ad930e46bdcc6555d72fbdb84cef6dc855caa7;hb=eb89ea10c8c11d2ef12239cb037c958dec50f006;hp=0fd65d3a76a70e13c83b190f632135c6d8afa278;hpb=5a5c6d7f0fae7ad6c0af49d7742955cb6cf618cf;p=senf.git diff --git a/doclib/filter.pl b/doclib/filter.pl index 0fd65d3..14ad930 100755 --- a/doclib/filter.pl +++ b/doclib/filter.pl @@ -1,8 +1,21 @@ #!/usr/bin/perl -n -if (/^\s*\\code\s*$/ .. /\\endcode/) { - $i=length((/^(\s*)/)[0]) if /^\s*\\code\s*$/; - print substr($_,$i); -} else { - print; +BEGIN { + ($topdir=$0) =~ s{doclib/.*$}{}; + print $topdir,"\n"; +} + +s/\s*$//; +while (s/\t/' 'x(8-length($`)%8)/e) {} + +if (/^\s*\\code$/ .. /\\endcode/ && !/^$/) { + $i=length($1) if /^(\s*)\\code$/; + print substr($_,$i),"\n"; +} +elsif (s/^(\s*)
$/$1/ .. /<\/pre>/ && !/^$/) { + $i=length($1) if /^(\s*)$/; + print substr($_,$i),"\n"; +} +else { + print $_,"\n"; }