-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakebzdocs
More file actions
executable file
·36 lines (25 loc) · 873 Bytes
/
makebzdocs
File metadata and controls
executable file
·36 lines (25 loc) · 873 Bytes
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
#!/usr/bin/perl -w
use File::Slurp;
chdir("/usr/src/bugzilla/docs/en/xml/");
# Hack to copy and paste entities into each file
my @ents_files = ("bugzilla.ent", "about.xml");
my $ents = "";
foreach my $ent_file (@ents_files) {
my @lines = read_file($ent_file);
@lines = grep(/<!ENTITY/, @lines);
$ents .= join("", @lines);
}
# Add any used entities that DocBook defines itself
$ents .= "<!ENTITY mdash \"—\">\n";
# We munge the file into a temporary file before calling db2rst.py on it
foreach my $infile (glob("*.xml")) {
# Empty bogus file
next if $infile eq "index.xml";
my $text = read_file($infile);
my $basename = $infile;
$basename =~ s/\.xml$//;
$text =~ s/%myents;/$ents/;
write_file("$basename.tmp", $text);
system("db2rst.py $basename.tmp > ../rst/source/$basename.rst");
unlink($basename . ".tmp");
}