source: trunk/gli/help/splithelpdocument.pl@ 5518

Last change on this file since 5518 was 5425, checked in by mdewsnip, 21 years ago

Small Perl script for splitting the output of "java ApplyXSLT gen-many-html.xsl in.xml" into separate files.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# splithelpdocument.pl
6#
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 1999 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29
30sub main
31{
32 local @lines = <STDIN>;
33
34 local $filestart = 0;
35 local $filename = "";
36 for ($i = 0; $i < scalar(@lines); $i++) {
37 local $line = $lines[$i];
38
39 if ($line =~ /\<a name=\"([^\"]+)\"\>/ && $filename eq "") {
40 $filename = $1;
41 }
42
43 if ($line =~ /^\<html\>/ && $i > $filestart) {
44 open(FILE_OUT, ">$filename.htm") or die "Error: Could not write $filename.htm.\n";
45 for ($j = $filestart; $j < $i; $j++) {
46 print FILE_OUT $lines[$j];
47 }
48 close(FILE_OUT);
49
50 $filestart = $i;
51 $filename = "";
52 }
53 }
54}
55
56
57&main(@ARGV);
Note: See TracBrowser for help on using the repository browser.