17.02.2020 00:21, Alexander Lakhin wrote:
> 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.
I've managed to simplify the patch a little by incorporating those
templates in stylesheet-fo.xsl.

Maybe it's better to use the same formatting as in the docbook xsl
template (see docbook/stylesheet/docbook-xsl/xhtml-1_1/inline.xsl).
There "$menuchoice.menu.separator" is enclosed in <fo:inline
font-size=".75em" font-family="{$symbol.font.family}">...</fo:inline>
and you can see the effect on page 536 (IPC parameters can be set in the
System Administration Manager (SAM) under Kernel Configu-
ration → Configurable Parameters.)

Yet another possibility is to use the docbook tags:
<funcdef><function>func()</function>
<returnvalue>int</returnvalue></funcdef>.
Then we can define the desired formatting for such markup (similar to
<menuchoice><guimenu>...</guimenu><guimenuitem>...</guimenuitem></menuchoice>).

Best regards,
Alexander
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index ea754084be0..7b843e7037f 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -94,4 +94,35 @@
   </fo:bookmark>
 </xsl:template>
 
+<xsl:template match="text()">
+  <xsl:choose>
+    <xsl:when test='contains(., "&#8594;")'>
+      <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, "&#8594;")'>
+      <xsl:call-template name="shift_arrow_up">
+        <xsl:with-param name="text" select='substring-before($text, "&#8594;")'/>
+      </xsl:call-template>
+      <fo:inline baseline-shift="10%">&#8594;</fo:inline>
+      <xsl:call-template name="shift_arrow_up">
+        <xsl:with-param name="text" select='substring-after($text, "&#8594;")'/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$text"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>

Reply via email to