Andreas Hoenen <andr...@hoenen-terstappen.de> wrote:

> Hi Benoît,
>
> I want to inform you of Debian BTS report #634563 [1], which has been
> tracked down from the affected package xmlunit ("a library that enables
> unit testing of XML") to dblatex:
<snip/>
> Attached is the problematic file [2]: by comparison of intermediate
> files XMLUnit-Java.tex for both dblatex versions and some experimenting
> I have tracked down the problem to the command:
>
> pdftitle={XMLUnit Java User's Guide
>  
> \imgexists{xmlunit.png}{{\imgevalsize{xmlunit.png}{\includegraphics[width=331pt,height=100pt,keepaspectratio=true]{xmlunit.png}}}}{}
>   },%
>
> Image inclusion in PDF title is a new feature of version 0.3.2, isn't
> it?  However there seems to be a problem with it, unfortunately I'm in
> lack of the necessary in-depth TeX knowledge to analyze further.
<snip/>

Hi Benoît,

meanwhile I think that the problem is not about how to include an image
into the pdftitle field, but that the image clause has been included
_accidentally_ into the pdftitle: the image clause is only targeted at
the document's title, but not for the pdftitle field.  Correct?

Thus I have created a somewhat clumsy hotfix [1]: computing a separate
XSL variable "pdftitle" based on the contents of the previously computed
XSL variable "title", stripping off any image clause.  Detecting and
stripping off an embedded image clause is somewhat fragile: if you ever
change the structure of the image clause in "title" determination,
"pdftitle" computation would need to get adapted.

At least both possible settings of configuration parameter
imagedata.file.check are taken into account, I used the "pdfinfo"
command for inspecting the resulting pdftitle value.

If you are developing a more elegant respectively robust way for fixing
the problem, let me know, otherwise I would release a new Debian dblatex
release with my hotfix soon, as the BTS report is quite urgent due to
the FTBFS: "Serious (policy violations or makes package unfit for
release)"

[1] 
Author: Andreas Hoenen <andr...@hoenen-terstappen.de>
Description: Patch for BTS report #634563:
Don't try to include a title image in the pdftitle field of TeX package
hyperref, as this field doesn't support images.
--- a/xsl/preamble.xsl
+++ b/xsl/preamble.xsl
@@ -104,6 +104,21 @@
                                  |articleinfo/title
                                  |artheader/title)[1]" mode="coverpage"/>
   </xsl:variable>
+  <xsl:variable name="pdftitle.image.start.clause">
+    <xsl:choose>
+      <xsl:when test="$imagedata.file.check='1'">\imgexists</xsl:when>
+      <xsl:otherwise>{\imgevalsize</xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:variable name="pdftitle">
+    <xsl:choose>
+      <xsl:when test="contains($title,$pdftitle.image.start.clause)">
+        <xsl:value-of select="substring-before($title,
+                                               $pdftitle.image.start.clause)"/>
+      </xsl:when>
+      <xsl:otherwise><xsl:value-of select="$title"/></xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
 
   <!-- Get the Authors -->
   <xsl:variable name="authors">
@@ -135,7 +150,7 @@
     <xsl:text>},%&#10;</xsl:text>
   </xsl:if>
   <xsl:text>pdftitle={</xsl:text>
-  <xsl:value-of select="$title"/>
+  <xsl:value-of select="$pdftitle"/>
   <xsl:text>},%&#10;</xsl:text>
   <xsl:text>pdfauthor={</xsl:text>
   <xsl:value-of select="$authors"/>
Regards, Andreas
-- 
Andreas Hoenen <andr...@hoenen-terstappen.de>
GPG: 1024D/B888D2CE
     A4A6 E8B5 593A E89B 496B
     82F0 728D 8B7E B888 D2CE

Attachment: pgprH7tiGOUhj.pgp
Description: PGP signature

Reply via email to