summaryrefslogtreecommitdiffstats
path: root/gnome-users-guide/gnome-users-guide-1.4/it/applets/applet2ug
blob: c1c2be59a671b3f90f0c3cb4351f79a31d76a5e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w
#
# THIS SCRIPT CHANGES THE SECTION LABELLING
#
# example input name: sound-monitor or sound-monitor.sgml
# example output name: sound-monitor.sgml.ug
#

$_ =  shift @ARGV;
s/.sgml//;
$basename=$_;
$infilename=$basename . ".sgml";
$outfilename=$basename . "-ug.sgml";

print ("Reading: $infilename\n");
open (IN,$infilename) || die "can't open file: $!";
print ("Writing: $outfilename\n");
open (OUT,">$outfilename") || die "can't open file for writing: $!";

while (<IN>) {
	# Now comment out the license
	s/<sect2 id="license">/<!-- 
   <sect2 id="license">/;
	s/<\/sect1>/--> 
 <\/sect1>/;

	# Start by substituting sections (sect4->sect5, sect3->sect4, ...)
	s/sect4/sect5/;
	s/sect3/sect4/;
	s/sect2/sect3/;
	s/sect1/sect2/;

	# Now try to pluck out any id's which could be problematic
	s/id="authors"/id="$basename-authors"/;
	s/id="bugs"/id="$basename-bugs"/;
	s/id="prefs"/id="$basename-prefs"/;
	s/id="usage"/id="$basename-usage"/;

	print OUT $_;
}
close (IN) || die "can't close $infilename: $!";
close (OUT) || die "can't close $outfilename: $!";