From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-docs@lists.postgresql.org
Subject: Re: Getting our tables to render better in PDF output
Date: Mon, 17 Feb 2020 00:21:24 +0300
Message-ID: <5d1f5b72-1b4a-6e15-6730-d94e2252a073@gmail.com> (raw)
In-Reply-To: <10810.1581883655@sss.pgh.pa.us>
References: <20200212221818.GA15503@alvherre.pgsql>
<23574.1581555393@sss.pgh.pa.us>
<10810.1581883655@sss.pgh.pa.us>
Hello Tom,
> 16.02.2020 23:07, Tom Lane wrote:
>
>
> I poked at this a little bit, and found that I could get a pretty
> decent-looking result if I hacked the .fo file to contain
> "<fo:inline baseline-shift="10%">→</fo:inline>" rather than a bare
> right arrow. (See attached screenshot, wherein the last rightarrow
> was fixed this way but the others weren't.) However, I do not
> have much of a clue as to how such a fix might be injected into
> our stylesheets --- anybody have a suggestion?
Please look at the XSLT template for processing .fo before calling fop.
Maybe this can be done with just the existing stylesheet-fo.xsl, I'll
try to research this later.
Best regards,
Alexander
Attachments:
[text/x-patch] shift_arrow_up.patch (2.5K, ../5d1f5b72-1b4a-6e15-6730-d94e2252a073@gmail.com/2-shift_arrow_up.patch)
download | inline diff:diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefileindex 0401a515df8..3be29dba9f1 100644--- a/doc/src/sgml/Makefile+++ b/doc/src/sgml/Makefile@@ -169,10 +169,14 @@ XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
%-A4.fo: stylesheet-fo.xsl %.sgml $(ALLSGML)
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $(wordlist 1,2,$^)
+ $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) -o $@.tmp $(@D)/pg-customize-fo.xsl $@+ mv $@.tmp $@
%-US.fo: stylesheet-fo.xsl %.sgml $(ALLSGML)
$(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $(wordlist 1,2,$^)
+ $(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) -o $@.tmp $(@D)/pg-customize-fo.xsl $@+ mv $@.tmp $@
%.pdf: %.fo $(ALL_IMAGES)
$(FOP) -fo $< -pdf $@
diff --git a/doc/src/sgml/pg-customize-fo.xsl b/doc/src/sgml/pg-customize-fo.xslnew file mode 100644index 00000000000..ba3138e2a3d--- /dev/null+++ b/doc/src/sgml/pg-customize-fo.xsl@@ -0,0 +1,42 @@+<?xml version="1.0" encoding="UTF-8"?>+<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">++ <xsl:template match="@*|node()">+ <xsl:copy>+ <xsl:apply-templates select="@*|node()"/>+ </xsl:copy>+ </xsl:template>++ <xsl:template match="fo:block//text()">+ <xsl:choose>+ <xsl:when test='contains(., "→")'>+ <xsl:call-template name="shift_arrow_up">+ <xsl:with-param name="text" select="."/>+ </xsl:call-template>+ </xsl:when>+ <xsl:otherwise>+ <xsl:value-of select="."/>+ </xsl:otherwise>+ </xsl:choose>+ </xsl:template>++ <xsl:template name="shift_arrow_up">+ <xsl:param name="text" />+ <xsl:choose>+ <xsl:when test='contains($text, "→")'>+ <xsl:call-template name="shift_arrow_up">+ <xsl:with-param name="text" select='substring-before($text, "→")'/>+ </xsl:call-template>+ <fo:inline baseline-shift="10%">→</fo:inline>+ <xsl:call-template name="shift_arrow_up">+ <xsl:with-param name="text" select='substring-after($text, "→")'/>+ </xsl:call-template>+ </xsl:when>+ <xsl:otherwise>+ <xsl:value-of select="$text"/>+ </xsl:otherwise>+ </xsl:choose>+ </xsl:template>++</xsl:stylesheet>
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: pgsql-docs@postgresql.org
Cc: exclusion@gmail.com, tgl@sss.pgh.pa.us, pgsql-docs@lists.postgresql.org
Subject: Re: Getting our tables to render better in PDF output
In-Reply-To: <5d1f5b72-1b4a-6e15-6730-d94e2252a073@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox