datazuul / epub-tools

Automatically exported from code.google.com/p/epub-tools
0 stars 0 forks source link

db2epub wrongly adds files + directories of conditional images #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've been using db2epub.py for a while with docbook 1.76.1 and the current 
snapshot.

I noticed that when I make this customization in my stylesheet 

  <xsl:param name="use.role.for.mediaobject" select="1"/>
        <xsl:param name="preferred.mediaobject.role">epub</xsl:param>

db2epub.py will add references to all the image files (i.e. 
"images-kindle/tall1.jpg, images-epub/tall1.jpg, and images-website/tall1.jpg" 
even if they are not actually used in the epub file. That bloats the epub file 
unnecessarily. I would expect that if I set the preferred.mediaobject.role to 
be "epub", that the only file to be added to the output epub file would be 
images-epub/tall1.jpg"

SOURCE IN DOCBOOK

   <mediaobject role="tall-image-right">
            <imageobject role="kindle">
                <imagedata  contentwidth="300px" contentdepth="477px" fileref="images-kindle/tall1.jpg"/>
            </imageobject>
            <imageobject role="epub">
                <imagedata  fileref="images-epub/tall1.jpg"/>
            </imageobject>
            <imageobject role="website">
                <imagedata  fileref="images-website/tall1.jpg"/>
            </imageobject>

            <textobject>
                <phrase>configuring your IIS host header</phrase>
            </textobject>
            <caption>
                <para> For every hard problem there is a solution which is simple,
                    obvious and wrong. That was H.L. Mencken who said that, I believe. 
                </para>
            </caption>

        </mediaobject>

Original issue reported on code.google.com by idiotpro...@gmail.com on 26 Sep 2011 at 5:47