forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gav...." <brightoncomput...@brightontown.com.au>
Subject RE: [jira] Commented: (FOR-635) images not reproduced in PDFs, if sources are in xdocs/images directory
Date Sat, 13 May 2006 12:49:52 GMT


> -----Original Message-----
> From: Ross Gardler (JIRA) [mailto:jira@apache.org]
> Sent: Saturday, 13 May 2006 9:29 AM
> To: dev@forrest.apache.org
> Subject: [jira] Commented: (FOR-635) images not reproduced in PDFs, if
> sources are in xdocs/images directory
> 
>     [ http://issues.apache.org/jira/browse/FOR-
> 635?page=comments#action_12383339 ]
> 
> Ross Gardler commented on FOR-635:
> ----------------------------------
> 
> (some notes I'm working on about 3 issues at once due to Forrest Friday
> and IRC - need this so we don't forget what we have discovered)
> 
> Looking at http://localhost:8888/samples/sample.fo
> 
> we see that an xdoc entry of:
> 
> <icon height="22" width="26" src="../images/icon.png" alt="feather"/>

Why use ../ at all ?

The two images directories are static so this relevant from document rubbish
Is not needed. 

And, is ../images intended to be /resources/images or /xdocs/images ?

There can also be ../../../images/icon.png if the nested directories are
deep enough. In all nested or root cases specifying /images/icon.png would
Always work. Can we do away with dotdots ?

As I see it, there are 3 possible locations.

1. /resources/images

In which case we specify src="images/icon.png"

And this works for pdf as it matches :-

xsl:when test="starts-with(string(@src),'images/')">
           <xsl:value-of select="concat($imagesdir,substring-
 after(@src,'images'))"/>
         </xsl:when>

2. /xdocs/images

In which case we specify src="/images/icon.png"

This should work but does not, the match is :-

xsl:when test="contains(string(@src),':') or starts-
 with(string(@src),'/')">
           <xsl:value-of select="@src"/>
         </xsl:when>

Now, I can not see why this does not work at this stage.
We need to test that when test to make sure the syntax
Is correct. Maybe it does not like '/' and is treating the 
/ as an escape character or something. Could it be we need
Two in there '//' so the first one escapes and second one
Gets read properly, I don't know just thinking loud.

What about ':' , what is that there for ?

Anyway currently then src="/images/icon.png" is therefore
Falling through to the default otherwise.

3. image

In which case we specify src="icon.png"

In other words, the image is in the same directory as the file.
If the image is not required in either 1. or 2. above then this
In the only other place that it might be wanted.

The match for this is :-

 <xsl:otherwise><xsl:value-of
 select="concat($xmlbasedir,@src)"/></xsl:otherwise>
 </xsl:choose>

$xmlbasedir would be xdocs + '.' so should be ok.

As mentioned by Ross, the use of ../images/icon.png also
Falls through to this otherwise at the moment.

Can I suggest at least for the moment we add a match to the first when to
Account for this so it looks in the /resources/images/ directory for it.

The first match would then look like :-

xsl:when test="starts-with(string(@src),'images/') or
starts-with(string(@src),'../')">
           <xsl:value-of select="concat($imagesdir,substring-
 after(@src,'images'))"/>
         </xsl:when>

The end result will be all images that start with '../images' or '/images'
will resolve To look in /resources/images and those that start with just
'images' will look in /xdocs/images and those that just have 'image.png'
will Look in the current directory.

Eventually we should weed out ../ ../../ etc refs and make them just /.


WDYT?

Gav...

> 
> gets converted to an fo entry of:
> 
> <fo:external-graphic
> src="D:\tmp\forrest/src/documentation/content/xdocs/samples/../images/icon
> .png" height="22" width="26"/>
> 
> This happens because of document-to-fo.xsl:
> 
> <xsl:choose>
>         <!-- resources image dir -->
>         <xsl:when test="starts-with(string(@src),'images/')">
>           <xsl:value-of select="concat($imagesdir,substring-
> after(@src,'images'))"/>
>         </xsl:when>
>         <!-- already absolute -->
>         <xsl:when test="contains(string(@src),':') or starts-
> with(string(@src),'/')">
>           <xsl:value-of select="@src"/>
>         </xsl:when>
>         <!-- relative to document -->
>         <xsl:otherwise><xsl:value-of
> select="concat($xmlbasedir,@src)"/></xsl:otherwise>
> </xsl:choose>
> 
> > images not reproduced in PDFs, if sources are in xdocs/images directory
> > -----------------------------------------------------------------------
> >
> >          Key: FOR-635
> >          URL: http://issues.apache.org/jira/browse/FOR-635
> >      Project: Forrest
> >         Type: Bug
> 
> >   Components: Documentation and website
> >     Versions: 0.7, 0.8-dev
> >     Reporter: David Crossley
> >     Priority: Minor
> >      Fix For: 0.8-dev
> 
> >
> > We used to enable images to be placed in the xdocs/images directory.
> However, now they are intended to go in the resources/images directory
> instead. Both methods will work for html pages, but  only the latter
> method for the PDF pages.
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
> 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.392 / Virus Database: 268.5.6/338 - Release Date: 12/05/2006



Mime
View raw message