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

Commit 0012979

Browse files
committed
docs: html: copy images to output as part of xslt build
Until now the meson built HTML docs had non-working references to images. They were copied in the make target. Instead of duplicating that for meson, copy them as part of the xslt stylesheet. Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com
1 parent ef07d35 commit 0012979

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

doc/src/sgml/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ html: html-stamp
144144

145145
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
146146
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
147-
cp $(ALL_IMAGES) html/
148147
cp $(srcdir)/stylesheet.css html/
149148
touch $@
150149

doc/src/sgml/stylesheet-common.xsl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,26 @@
101101
<xsl:apply-templates select="." mode="xref"/>
102102
</xsl:template>
103103

104+
105+
<!--
106+
Support for copying images to the output directory, so the output is self
107+
contained.
108+
-->
109+
<xsl:template name="write-image">
110+
<xsl:variable name="input_filename">
111+
<xsl:value-of select="imagedata/@fileref"/>
112+
</xsl:variable>
113+
114+
<!-- references images directly, without images/ -->
115+
<xsl:variable name="output_filename">
116+
<xsl:value-of select="concat($chunk.base.dir, substring-after($input_filename, '/'))"/>
117+
</xsl:variable>
118+
119+
<xsl:call-template name="write.chunk">
120+
<xsl:with-param name="filename" select="$output_filename"/>
121+
<xsl:with-param name="content" select="document($input_filename)"/>
122+
</xsl:call-template>
123+
</xsl:template>
124+
125+
104126
</xsl:stylesheet>

doc/src/sgml/stylesheet.xsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
</xsl:param>
3030

3131

32+
<!-- copy images to the output directory, so the output is self contained -->
33+
<xsl:template match="imageobject">
34+
<xsl:call-template name="write-image"/>
35+
<xsl:apply-templates select="imagedata"/>
36+
</xsl:template>
37+
3238
<!-- strip directory name from image filerefs -->
3339
<xsl:template match="imagedata/@fileref">
3440
<xsl:value-of select="substring-after(., '/')"/>

0 commit comments

Comments
 (0)