agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
Subject: [PATCH v3 2/4] docs: load stylesheet via custom.css.source
Date: Fri, 24 Mar 2023 00:13:53 -0700
---
doc/src/sgml/Makefile | 4 +---
doc/src/sgml/meson.build | 12 ++++++------
doc/src/sgml/stylesheet-common.xsl | 14 ++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 1 -
doc/src/sgml/stylesheet-html-nochunk.xsl | 3 +++
doc/src/sgml/stylesheet.css.xml | 8 ++++++++
doc/src/sgml/stylesheet.xsl | 11 -----------
7 files changed, 32 insertions(+), 21 deletions(-)
create mode 100644 doc/src/sgml/stylesheet.css.xml
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 1b098f983ec..9be480613b4 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -39,7 +39,7 @@ ifndef FOP
FOP = $(missing) fop
endif
-XMLINCLUDE = --path .
+XMLINCLUDE = --path . --path $(srcdir)
ifdef XMLLINT
XMLLINT := $(XMLLINT) --nonet
@@ -144,14 +144,12 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css html/
touch $@
htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
# single-page HTML
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 157b8589e55..d9c46224dc9 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -104,7 +104,7 @@ if xsltproc_bin.found()
xsltproc_flags = [
'--nonet',
'--stringparam', 'pg.version', pg_version,
- '--param', 'website.stylesheet', '1'
+ '--path', '@CURRENT_SOURCE_DIR@', '--path', '@OUTDIR@',
]
xsltproc = xmltools_wrapper + [
@@ -140,7 +140,7 @@ if xsltproc_bin.found()
output: 'htmlhelp',
depfile: 'htmlhelp.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += htmlhelp
@@ -152,7 +152,7 @@ if xsltproc_bin.found()
output: 'postgres.html',
depfile: 'postgres.html.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += postgres_html
@@ -180,14 +180,14 @@ if xsltproc_bin.found()
output: 'INSTALL.xml',
depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
)
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
depfile: 'INSTALL.html.d',
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += install_html
@@ -216,7 +216,7 @@ if xsltproc_bin.found()
output: ['man1', 'man3', 'man7'],
depfile: 'man.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += man
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index d2928f86eb7..c1a7d46bcc6 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -42,6 +42,20 @@
<xsl:param name="variablelist.term.separator"></xsl:param>
<xsl:param name="xref.with.number.and.title" select="0"></xsl:param>
+<!--
+ currently htmlhelp and "normal" html have no common stylesheet, so this is
+ implemented here
+-->
+<xsl:param name="website.stylesheet" select="0"/>
+
+<xsl:param name="custom.css.source">
+ <xsl:if test="$website.stylesheet = 0">stylesheet.css.xml</xsl:if>
+</xsl:param>
+
+<xsl:param name="html.stylesheet">
+ <xsl:if test="not($website.stylesheet = 0)">https://www.postgresql.org/media/css/docs-complete.css.xml</xsl:if;
+</xsl:param>
+
<!-- Change display of some elements -->
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 568ccf36d2a..fb659d2ec38 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -9,7 +9,6 @@
<xsl:param name="htmlhelp.use.hhk" select="'1'"/>
<xsl:param name="base.dir" select="'htmlhelp/'"></xsl:param>
-<xsl:param name="html.stylesheet" select="'stylesheet.css'"></xsl:param>
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="manifest.in.base.dir" select="1"/>
<xsl:param name="make.valid.html" select="1"></xsl:param>
diff --git a/doc/src/sgml/stylesheet-html-nochunk.xsl b/doc/src/sgml/stylesheet-html-nochunk.xsl
index 8167127b93a..fae8d5fbd96 100644
--- a/doc/src/sgml/stylesheet-html-nochunk.xsl
+++ b/doc/src/sgml/stylesheet-html-nochunk.xsl
@@ -7,6 +7,9 @@
<xsl:include href="stylesheet-html-common.xsl" />
<xsl:include href="stylesheet-speedup-xhtml.xsl" />
+<!-- embed stylesheet.css if using that -->
+<xsl:param name="generate.css.header" select="$website.stylesheet = 0"/>
+
<!-- embed SVG images into output file -->
<xsl:template match="imagedata[@format='SVG']">
<xsl:variable name="filename">
diff --git a/doc/src/sgml/stylesheet.css.xml b/doc/src/sgml/stylesheet.css.xml
new file mode 100644
index 00000000000..a21fcca576f
--- /dev/null
+++ b/doc/src/sgml/stylesheet.css.xml
@@ -0,0 +1,8 @@
+<!--
+ wrapper around stylesheet.css.xml to allow it to be loaded via docbook-xsl's
+ generate.css.header parameter.
+-->
+<!DOCTYPE style [
+<!ENTITY css SYSTEM "stylesheet.css">
+]>
+<style>&css;</style>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index f9163e7d946..65606ca3dbe 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -17,17 +17,6 @@
<xsl:param name="chunk.quietly" select="1"></xsl:param>
<xsl:param name="admon.style"></xsl:param> <!-- handled by CSS stylesheet -->
-<xsl:param name="website.stylesheet" select="0"/>
-
-<xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test="$website.stylesheet = 0">stylesheet.css</xsl:when>
- <xsl:otherwise>
- https://www.postgresql.org/media/css/docs-complete.css
- </xsl:otherwise>
- </xsl:choose>
-</xsl:param>
-
<xsl:template match="imageobject">
<xsl:call-template name="write-image"/>
--
2.38.0
--l5hiy5hty64mvsca
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v3-0003-docs-speed-up-docs-build-by-special-casing-the-ge.patch"
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v3 2/4] docs: load stylesheet via custom.css.source
In-Reply-To: <no-message-id-109572@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox