Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 044d9ef

Browse files
committed
Create INSTALL file via XSLT
As before, create an INSTALL.html file for processing with lynx, but use xsltproc and a new XSLT stylesheet instead of jade and DSSSL. Replacing jade with xsltproc removes jade from the requirements for distribution building. Reviewed-by: Magnus Hagander <magnus@hagander.net>
1 parent d952860 commit 044d9ef

File tree

4 files changed

+120
-57
lines changed

4 files changed

+120
-57
lines changed

doc/src/sgml/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/man-stamp
88
# Other popular build targets
99
/INSTALL
10+
/INSTALL.xml
1011
/postgres-US.pdf
1112
/postgres-A4.pdf
1213
/postgres.html

doc/src/sgml/Makefile

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,9 @@ postgres.pdf:
217217

218218

219219
##
220-
## Semi-automatic generation of some text files.
220+
## Generation of some text files.
221221
##
222222

223-
JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
224223
ICONV = iconv
225224
LYNX = lynx
226225

@@ -233,10 +232,15 @@ LYNX = lynx
233232
# locale support and is very picky about locale name spelling. The
234233
# below has been finely tuned to run on FreeBSD and Linux/glibc.
235234
INSTALL: % : %.html
236-
$(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | LC_ALL=en_US.ISO8859-1 $(LYNX) -force_html -dump -nolist -stdin | $(ICONV) -f latin1 -t us-ascii//TRANSLIT > $@
235+
$(PERL) -p -e 's,<h(1|2) class="title",<h\1 align=center,g' $< | LC_ALL=en_US.ISO8859-1 $(LYNX) -force_html -dump -nolist -stdin | $(ICONV) -f latin1 -t us-ascii//TRANSLIT > $@
237236

238-
INSTALL.html: standalone-install.sgml installation.sgml version.sgml
239-
$(JADE.text) -V nochunks standalone-install.sgml installation.sgml > $@
237+
INSTALL.html: %.html : stylesheet-text.xsl %.xml
238+
$(XMLLINT) --noout --valid $*.xml
239+
$(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $^ >$@
240+
241+
INSTALL.xml: standalone-install.sgml installation.sgml version.sgml
242+
$(OSX) -D. -x lower $(filter-out version.sgml,$^) >$@.tmp
243+
$(call mangle-xml,chapter)
240244

241245

242246
##
@@ -247,12 +251,15 @@ INSTALL.html: standalone-install.sgml installation.sgml version.sgml
247251
# if we try to do "make all" in a VPATH build without the explicit
248252
# $(srcdir) on the postgres.sgml dependency in this rule. GNU make bug?
249253
postgres.xml: $(srcdir)/postgres.sgml $(ALMOSTALLSGML)
250-
$(OSX) -D. -x lower -i include-xslt-index $< >postgres.xmltmp
251-
$(PERL) -p -e 's/\[(aacute|acirc|aelig|agrave|amp|aring|atilde|auml|bull|copy|eacute|egrave|gt|iacute|lt|mdash|nbsp|ntilde|oacute|ocirc|oslash|ouml|pi|quot|scaron|uuml) *\]/\&\1;/gi;' \
252-
-e '$$_ .= qq{<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\n} if $$. == 1;' \
253-
<postgres.xmltmp > $@
254-
rm postgres.xmltmp
255-
# ' hello Emacs
254+
$(OSX) -D. -x lower -i include-xslt-index $< >$@.tmp
255+
$(call mangle-xml,book)
256+
257+
define mangle-xml
258+
$(PERL) -p -e 's/\[(aacute|acirc|aelig|agrave|amp|aring|atilde|auml|bull|copy|eacute|egrave|gt|iacute|lt|mdash|nbsp|ntilde|oacute|ocirc|oslash|ouml|pi|quot|scaron|uuml) *\]/\&\1;/gi;' \
259+
-e '$$_ .= qq{<!DOCTYPE $(1) PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\n} if $$. == 1;' \
260+
<$@.tmp > $@
261+
rm $@.tmp
262+
endef
256263

257264
ifeq ($(STYLE),website)
258265
XSLTPROC_HTML_FLAGS += --param website.stylesheet 1
@@ -386,21 +393,21 @@ check-tabs:
386393
# This allows removing some files from the distribution tarballs while
387394
# keeping the dependencies satisfied.
388395
.SECONDARY: postgres.xml $(GENERATED_SGML) HTML.index
389-
.SECONDARY: INSTALL.html
396+
.SECONDARY: INSTALL.html INSTALL.xml
390397
.SECONDARY: %-A4.tex-ps %-US.tex-ps %-A4.tex-pdf %-US.tex-pdf
391398

392399
clean:
393400
# text --- these are shipped, but not in this directory
394401
rm -f INSTALL
395-
rm -f INSTALL.html
402+
rm -f INSTALL.html INSTALL.xml
396403
# single-page output
397404
rm -f postgres.html postgres.txt
398405
# print
399406
rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
400407
# index
401408
rm -f HTML.index $(GENERATED_SGML)
402409
# XSLT
403-
rm -f postgres.xml postgres.xmltmp htmlhelp.hhp toc.hhc index.hhk *.fo
410+
rm -f postgres.xml *.tmp htmlhelp.hhp toc.hhc index.hhk *.fo
404411
# EPUB
405412
rm -f postgres.epub
406413
# Texinfo

doc/src/sgml/stylesheet-text.xsl

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version='1.0'?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
version='1.0'
4+
xmlns="http://www.w3.org/TR/xhtml1/transitional"
5+
exclude-result-prefixes="#default">
6+
7+
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
8+
<xsl:import href="stylesheet-common.xsl" />
9+
10+
<!-- The customizations here are somewhat random in order to make the text
11+
output look good. -->
12+
13+
<!-- no section numbers or ToC -->
14+
<xsl:param name="chapter.autolabel" select="0"/>
15+
<xsl:param name="section.autolabel" select="0"/>
16+
<xsl:param name="generate.toc"></xsl:param>
17+
18+
<!-- don't need them, and they mess up formatting -->
19+
<xsl:template match="indexterm">
20+
</xsl:template>
21+
22+
<xsl:template match="step">
23+
<li>
24+
<xsl:call-template name="common.html.attributes"/>
25+
<xsl:call-template name="id.attribute"/>
26+
<!-- messes up formatting
27+
<xsl:call-template name="anchor"/>
28+
-->
29+
<xsl:apply-templates/>
30+
</li>
31+
</xsl:template>
32+
33+
<!-- produce "ASCII markup" for emphasis and such -->
34+
35+
<xsl:template match="emphasis">
36+
<xsl:text>*</xsl:text>
37+
<xsl:apply-templates/>
38+
<xsl:text>*</xsl:text>
39+
</xsl:template>
40+
41+
<xsl:template match="para/command|para/filename|para/option|para/replaceable">
42+
<xsl:call-template name="gentext.startquote"/>
43+
<xsl:apply-templates/>
44+
<xsl:call-template name="gentext.endquote"/>
45+
</xsl:template>
46+
47+
<xsl:template match="filename/replaceable|firstterm">
48+
<xsl:apply-templates/>
49+
</xsl:template>
50+
51+
<!-- tweak formatting for note, warning, etc. -->
52+
<xsl:template name="nongraphical.admonition">
53+
<div>
54+
<xsl:call-template name="common.html.attributes">
55+
<xsl:with-param name="inherit" select="1"/>
56+
</xsl:call-template>
57+
<xsl:call-template name="id.attribute"/>
58+
59+
<xsl:if test="$admon.textlabel != 0 or title or info/title">
60+
<p>
61+
<b>
62+
<xsl:call-template name="anchor"/>
63+
<xsl:apply-templates select="." mode="object.title.markup"/>:
64+
</b>
65+
</p>
66+
</xsl:if>
67+
68+
<xsl:apply-templates/>
69+
</div>
70+
</xsl:template>
71+
72+
<!-- horizontal rules before titles (matches old DSSSL style) -->
73+
74+
<xsl:template match="sect1/title
75+
|sect1/info/title
76+
|sect1info/title"
77+
mode="titlepage.mode" priority="2">
78+
<hr/>
79+
<xsl:call-template name="section.title"/>
80+
</xsl:template>
81+
82+
<xsl:template match="sect2/title
83+
|sect2/info/title
84+
|sect2info/title"
85+
mode="titlepage.mode" priority="2">
86+
<hr/>
87+
<xsl:call-template name="section.title"/>
88+
</xsl:template>
89+
90+
<xsl:template match="sect3/title
91+
|sect3/info/title
92+
|sect3info/title"
93+
mode="titlepage.mode" priority="2">
94+
<hr/>
95+
<xsl:call-template name="section.title"/>
96+
</xsl:template>
97+
98+
</xsl:stylesheet>

doc/src/sgml/stylesheet.dsl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<!-- must turn on one of these with -i on the jade command line -->
55
<!ENTITY % output-html "IGNORE">
66
<!ENTITY % output-print "IGNORE">
7-
<!ENTITY % output-text "IGNORE">
87

98
<![ %output-html; [
109
<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
@@ -14,10 +13,6 @@
1413
<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook Print Stylesheet//EN" CDATA DSSSL>
1514
]]>
1615

17-
<![ %output-text; [
18-
<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
19-
]]>
20-
2116
]>
2217

2318
<style-sheet>
@@ -796,44 +791,6 @@
796791

797792
]]> <!-- %output-print -->
798793

799-
800-
<!-- Plain text output customization ............................... -->
801-
802-
<!--
803-
This is used for making the INSTALL file and others. We customize the
804-
HTML stylesheets to be suitable for dumping plain text (via Netscape,
805-
Lynx, or similar).
806-
-->
807-
808-
<![ %output-text; [
809-
810-
(define %section-autolabel% #f)
811-
(define %chapter-autolabel% #f)
812-
(define $generate-chapter-toc$ (lambda () #f))
813-
814-
;; For text output, produce "ASCII markup" for emphasis and such.
815-
816-
(define ($asterix-seq$ #!optional (sosofo (process-children)))
817-
(make sequence
818-
(literal "*")
819-
sosofo
820-
(literal "*")))
821-
822-
(define ($dquote-seq$ #!optional (sosofo (process-children)))
823-
(make sequence
824-
(literal (gentext-start-quote))
825-
sosofo
826-
(literal (gentext-end-quote))))
827-
828-
(element (para command) ($dquote-seq$))
829-
(element (para emphasis) ($asterix-seq$))
830-
(element (para filename) ($dquote-seq$))
831-
(element (para option) ($dquote-seq$))
832-
(element (para replaceable) ($dquote-seq$))
833-
(element (para userinput) ($dquote-seq$))
834-
835-
]]> <!-- %output-text -->
836-
837794
</style-specification-body>
838795
</style-specification>
839796

0 commit comments

Comments
 (0)