From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- contrib/splitup-kde-chunk-online | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 contrib/splitup-kde-chunk-online (limited to 'contrib/splitup-kde-chunk-online') diff --git a/contrib/splitup-kde-chunk-online b/contrib/splitup-kde-chunk-online new file mode 100755 index 0000000..53003cc --- /dev/null +++ b/contrib/splitup-kde-chunk-online @@ -0,0 +1,88 @@ +#!/usr/bin/perl +# +# split up an HTML file generated with e.g. +# +# /opt/kde3/bin/meinproc --check \ +# --stylesheet `dirname $(KDE_XSL_STYLESHEET)`/kde-chunk-online.xsl \ +# $(srcdir)/index.docbook -o index.xml; +# +# into several HTML files. While processing the input file - which +# must be named index.xml - replace the following occurences: +# +# source destination +# --------------------------------------------------------------------------- +# HEAD/common ../common +# Search -literally nothing- +# docs.kde.org Home +# +# The script should be started in the directory where the file index.xml +# is located. The output files will be generated in the same directory. +# +# (C) 2007,2009 by Thomas Baumgart (ipwizard at users.sourceforge.net) +# +#*************************************************************************** +#* 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. * +#***************************************************************************/ + + +sub endFile +{ + close OUT; + $fileIdx--; + if($fileIdx > 0) { + open(OUT, ">> $fname[$fileIdx]") or die("Unable to open file"); + } +} + +sub startFile +{ + $fileIdx++; + my $node = shift; + $node =~ /FILENAME filename="(.*)"/; + my $name = $1; + $fname[$fileIdx] = $name; + open(OUT, "> $fname[$fileIdx]") or die("Unable to open file"); +} + +sub processLine +{ + my $line = shift; + # ......... + if($line =~ /(.*)(<\/FILENAME>)(.*)/) { + my $s = $1; + my $e = $3; + processLine($s); + endFile(); + processLine($e); + } + # ......... + elsif($line =~ /(.*)()(.*)/) { + my $s = $1; + my $f = $2; + my $e = $3; + processLine($s); + startFile($f); + processLine($e); + } + else { + # replace HEAD/common with ../common + $line =~ s#/HEAD/common#../common#g; + # don't show access to search form + $line =~ s#Search##g; + # don't link to docs.kde.org + $line =~ s#docs.kde.org#Home#g; + print OUT "$line\n"; + } +} + +$fileIdx = 0; +open(IN, "< index.xml"); +while() { + chomp($_); + my $line = $_; + processLine($line); +} +close IN; -- cgit v1.2.1