The code to unlink dropped relations in FinishPreparedTransaction() was
[PostgreSQL.git] / doc / src / sgml / generate_history.pl
blobd878d7939e3cda8b412aafacac22bac37fcf88b3
1 #! /usr/bin/perl -w
3 # generate_history.pl -- flatten release notes for use as HISTORY file
5 # Usage: generate_history.pl srcdir release.sgml >output.sgml
7 # The main point of this script is to strip out <link> references, which
8 # generally point into the rest of the documentation and so can't be used
9 # in a standalone build of the release notes. To make sure this is done
10 # everywhere, we have to fold in the sub-files of the release notes.
12 # $PostgreSQL$
14 use strict;
16 my($srcdir) = shift;
17 defined($srcdir) || die "$0: missing required argument: srcdir\n";
18 my($infile) = shift;
19 defined($infile) || die "$0: missing required argument: inputfile\n";
21 # Emit DOCTYPE header so that the output is a self-contained SGML document
22 print "<!DOCTYPE appendix PUBLIC \"-//OASIS//DTD DocBook V4.2//EN\">\n";
24 process_file($infile);
26 exit 0;
28 sub process_file {
29 my($filename) = @_;
31 local *FILE; # need a local filehandle so we can recurse
33 my($f) = $srcdir . '/' . $filename;
34 open(FILE, $f) || die "could not read $f: $!\n";
36 while (<FILE>) {
37 # Recursively expand sub-files of the release notes
38 if (m/^&(release-.*);$/) {
39 process_file($1 . ".sgml");
40 next;
43 # Remove <link ...> tags, which might span multiple lines
44 while (m/<link/) {
45 if (s/<link\s+linkend[^>]*>//) {
46 next;
48 # incomplete tag, so slurp another line
49 $_ .= <FILE>;
52 # Remove </link> too
53 s|</link>||g;
55 print;
57 close(FILE);