diff --git a/doc/xml/AdminRef/generate-xml.pl b/doc/xml/AdminRef/generate-xml.pl index f414bc699e..008f80fb08 100755 --- a/doc/xml/AdminRef/generate-xml.pl +++ b/doc/xml/AdminRef/generate-xml.pl @@ -11,10 +11,10 @@ open(ENTITIES, ">entities.dtd") || die; foreach $section (@sections) { printf "generating section %s...\n", $section; + my @entities = (); mkdir(sprintf "sect%d", $section); opendir($DIR, sprintf "%s/pod%d", $doc_man_pages, $section) || die; - open(SECT, sprintf ">sect%d.xml", $section) || die; while ($podfile = readdir($DIR)) { next unless $podfile =~ /\.pod$/; @@ -23,14 +23,24 @@ foreach $section (@sections) { printf "pod2refentry < %s > %s\n", $podfile, $xmlfile; - system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s", + my $rc = system(sprintf "./pod2refentry --section=%d < %s/pod%d/%s > sect%d/%s", $section, $doc_man_pages, $section, $podfile, $section, $xmlfile); + if ($rc != 0) { + die "Failed to generate sect${section}/${xmlfile}: $rc\n"; + } printf ENTITIES "\n", $entity, $section, $section, $xmlfile; - printf SECT "&%s%s;\n", $entity, $section; + + push(@entities, $entity); } closedir($DIR); + + open(SECT, sprintf ">sect%d.xml", $section) || die; + foreach $entity (sort(@entities)) { + printf SECT "&%s%s;\n", $entity, $section; + } + close(SECT); }