diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /doc/tools | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
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
Diffstat (limited to 'doc/tools')
-rw-r--r-- | doc/tools/Makefile.am | 4 | ||||
-rw-r--r-- | doc/tools/index-python | 52 | ||||
-rwxr-xr-x | doc/tools/index-texi | 60 | ||||
-rw-r--r-- | doc/tools/index.xsl | 34 | ||||
-rw-r--r-- | doc/tools/toc-docbook | 71 | ||||
-rw-r--r-- | doc/tools/toc-gsdoc | 24 | ||||
-rw-r--r-- | doc/tools/toc-python | 57 | ||||
-rwxr-xr-x | doc/tools/toc-texi | 47 |
8 files changed, 349 insertions, 0 deletions
diff --git a/doc/tools/Makefile.am b/doc/tools/Makefile.am new file mode 100644 index 00000000..4eb7f5af --- /dev/null +++ b/doc/tools/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = index-texi index-python index.xsl \ + toc-gsdoc toc-docbook toc-python + + diff --git a/doc/tools/index-python b/doc/tools/index-python new file mode 100644 index 00000000..96cfcd8f --- /dev/null +++ b/doc/tools/index-python @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'prefix=s' => \$prefix ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +print "<conceptindex>\n"; + +$ingroup = 0; +while (<FILE>) { + + if (/\<dt\>\<a href=\'(.+)'\>(.+)\<\/a\>/) { +# print "Index: $1, $2, $ingroup\n"; + if ($ingroup) { + $name = "$ingroup, $2"; + } else { + $name = $2; + } + $url = "$prefix/$1"; + print "<entry name=\"$name\" url=\"$url\"/>\n"; + } elsif (/\<dt\>(.+)/) { +# print "Ingroup: $1\n"; + $ingroup = $1; + } elsif (/\s+\<\/dl>/) { + $ingroup = 0; + } +} + +print "</conceptindex>\n"; +close(FILE); + + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\<CODE\>//g; + $str =~ s/\<\/CODE\>//g; + $str =~ s/\<TT\>//g; + $str =~ s/\<\/TT\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/index-texi b/doc/tools/index-texi new file mode 100755 index 00000000..8aa85184 --- /dev/null +++ b/doc/tools/index-texi @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +use Getopt::Long; + +GetOptions( 'map=s' => \%mapping ) || die "Wrong options\n"; + +for $file (@ARGV) { + + open(FILE, "$file") || die "File not found: $file\n"; + + $indir = 0; + + while (<FILE>) { + + if (/\<H1\>\<A NAME=\".*\" HREF=\".*\"\>(.*)\<\/A\>\<\/H1\>/) { + $index = $mapping{$1}; +# print "Index: $1 => $index\n"; + } elsif (/\<DIR\>/) { + $indir = 1; + } elsif (/\<\/DIR>/) { + $indir = 0; + } elsif ($indir) { + if (/\<LI\>\<A HREF=\"([^\"]*)\"\>([^<]*)\<\/A\>/) { + unless ($lastindex eq $index) { + if ($lastindex) { + print "</$lastindex>\n"; + } + print "<$index>\n"; + $lastindex = $index; + } + $name = dehtml($2); + $url = $1; + print STDOUT "<entry name=\"$name\" url=\"$url\"/>\n"; + } + } + } + + close(FILE); +} + +if ($lastindex) { + print "</$lastindex>\n"; +} + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\<CODE\>//g; + $str =~ s/\<\/CODE\>//g; + $str =~ s/\<TT\>//g; + $str =~ s/\<\/TT\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/index.xsl b/doc/tools/index.xsl new file mode 100644 index 00000000..8d3d0a52 --- /dev/null +++ b/doc/tools/index.xsl @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:output omit-xml-declaration="yes"/> + +<xsl:template match="/"><xsl:apply-templates/></xsl:template> + +<xsl:template match="text()|@*"></xsl:template> + +<xsl:template match="chapter"> + <xsl:variable name="url" select="@id"/> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="chapter/section[position()!=1]"> + <xsl:variable name="url" select="@id"/> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="indexterm"> + <xsl:choose> + <xsl:when test="./secondary and ./tertiary"> + <entry name="{primary}, {secondary}, {tertiary}" url="{$url}.html"/> + </xsl:when> + <xsl:when test="./secondary"> + <entry name="{primary}, {secondary}" url="{$url}.html"/> + </xsl:when> + <xsl:otherwise> + <entry name="{primary}" url="{$url}.html"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/doc/tools/toc-docbook b/doc/tools/toc-docbook new file mode 100644 index 00000000..6d16f9b3 --- /dev/null +++ b/doc/tools/toc-docbook @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +# Copyright (C) 2001 by Claudiu Costin +# <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +use Getopt::Long; + +my $prefix = ''; +my $depth = 1; +GetOptions( 'prefix=s' => \$prefix, + 'depth=i' => \$depth ) || die "Wrong options\n"; + +$initialdepth = $depth; +$b3=$b2=$b1=""; +$in_processing=0; +while (<>) { + chop; + + if (/Table of Contents<\/B/) { + $in_processing=1; + next; + } + last if (/List of Tables/); + next if (!$in_processing); + + if (/HREF=\"(.+)\"/) { + $url = $1; + } + if (/>(.+)<\/A/) { + $name=$1; + $name =~ s/\"/"e;/g; + $name =~ s/—/-/g; + $name =~ s/^\s*-?\s*//g; + $name =~ s/\.$//g; +# print "NAME $name\n"; + } + + if ($b3 =~ /><DL/i) { + $depth++; + $b3=$b2; + $b2=$b1; + $b1=$_; + next; + } + if ($b3 =~ /><\/DL/i) { + $depth--; + print " "x($depth-1) . "</tocsect${depth}>\n" if ($depth != $initialdepth-1); + $b3=$b2; + $b2=$b1; + $b1=$_; + next; + } + + if ($b3 =~ />.*<\/DT/i && $name ne "" && $url ne "") { + if ($b1 =~ /><DL/i) { + print " "x($depth-1) . "<tocsect${depth} name=\"$name\" url=\"$url\">\n"; + } else { + print " "x($depth-1) . "<tocsect${depth} name=\"$name\" url=\"$url\"/>\n"; + } + } + + # a simulated delay line with 6 cells + $b3=$b2; + $b2=$b1; + $b1=$_; +} diff --git a/doc/tools/toc-gsdoc b/doc/tools/toc-gsdoc new file mode 100644 index 00000000..69785d91 --- /dev/null +++ b/doc/tools/toc-gsdoc @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +use Getopt::Long; + +my $prefix = ''; +GetOptions( 'title=s' => \$title, + 'main=s' => \$main ) || die "Wrong options\n"; + +$file = $ARGV[0]; +open(FILE, "$file") || die "File not found: $file\n"; + +print "<tocsect1 name=\"$title\" url=\"$main.html\">\n"; + +while (<FILE>) { + + if (/\<item\>\<uref url=\"(.+)\.html\"\>(.+)\<\/uref\>\<\/item\>/) { + $name = $1; + $url = "$1.html"; + print " <tocsect2 name=\"$name\" url=\"$url\"/>\n"; + } + +} + +print "</tocsect1>\n"; 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 "<tocsect${depth} name=\"$title\" url=\"$main.html\""; + +while (<FILE>) { + + if (/^\s*href/ && !/.*\<\/A\>$/i) { + chop; + $_ = $_ . <FILE>; + } + if (/\<UL\>/i) { + $depth++; + } elsif (/\<\/UL\>/i) { + print "/" if ($prevdepth == $depth); + $depth--; + print ">\n</tocsect${depth}"; + } elsif (/^\s*href=\"([^\"]+)\"\>(.+)\<\/A\>$/i) { + $url = "$prefix/$1"; + $name = dehtml($2); + $name =~ s/\s+/ /g; + print "/" if ($prevdepth == $depth); + print ">\n<tocsect${depth} name=\"$name\" url=\"$url\""; + $prevdepth = $depth; + } +} + +print ">\n"; +close(FILE); + +sub dehtml +{ + my ( $str ) = @_; + + $str =~ s/\<(tt|b) class=\"([^\"]*)\"\>//g; + $str =~ s/\<\/(tt|b)\>//g; + $str =~ s/\<i\>//g; + $str =~ s/\<\/i\>//g; + + return $str; +} + +# Local Variables: +# mode: perl +# fill-column: 120 +# End: diff --git a/doc/tools/toc-texi b/doc/tools/toc-texi new file mode 100755 index 00000000..2be48fa6 --- /dev/null +++ b/doc/tools/toc-texi @@ -0,0 +1,47 @@ +#!/usr/bin/perl + +# Copyright (C) 2001 by Claudiu Costin +# <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +$depth=0; +$buffer=""; + +while (<>) { + chop; + + if ($buffer =~ /<ul>/i) { + $depth++; + $buffer = $_; + next; + } + if ($buffer =~ /<\/ul>/i) { + $depth--; + print " "x($depth-1) . "</tocsect${depth}>\n" if ($depth != 0); + $buffer = $_; + next; + } + + if ($buffer =~ /<li>/i) { + $buffer =~ /HREF=\"([^\"]+)\"/; + $url=$1; + $buffer =~ /\">(.+)<\/A>/; + $text=$1; + $text =~ s/<tt>//gi; + $text =~ s/<\/tt>//gi; + $text =~ s/<CODE>//gi; + $text =~ s/<\/CODE>//gi; + $text =~ s/<BR>//gi; + if (/<ul>/i) { + print " "x($depth-1) . "<tocsect${depth} name=\"$text\" url=\"$url\">\n"; + } else { + print " "x($depth-1) . "<tocsect${depth} name=\"$text\" url=\"$url\"/>\n"; + } + } + # a simulated delay line with one cell + $buffer = $_; +} |