From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- doc/tools/toc-python | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 doc/tools/toc-python (limited to 'doc/tools/toc-python') diff --git a/doc/tools/toc-python b/doc/tools/toc-python new file mode 100644 index 00000000..c91cdcf2 --- /dev/null +++ b/doc/tools/toc-python @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'prefix=s' => \$prefix, + 'title=s' => \$title, + 'main=s' => \$main ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +$prevdepth = 1; +$depth = 1; +print ") { + + if (/^\s*href/ && !/.*\<\/A\>$/i) { + chop; + $_ = $_ . ; + } + if (/\/i) { + $depth++; + } elsif (/\<\/UL\>/i) { + print "/" if ($prevdepth == $depth); + $depth--; + print ">\n(.+)\<\/A\>$/i) { + $url = "$prefix/$1"; + $name = dehtml($2); + $name =~ s/\s+/ /g; + print "/" if ($prevdepth == $depth); + print ">\n\n"; +close(FILE); + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\<(tt|b) class=\"([^\"]*)\"\>//g; + $str =~ s/\<\/(tt|b)\>//g; + $str =~ s/\//g; + $str =~ s/\<\/i\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: -- cgit v1.2.3