forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <d...@brondsema.net>
Subject Re: svn commit: rev 46087 - forrest/trunk/src/core/context/resources/chaperon/stylesheets
Date Wed, 15 Sep 2004 12:31:41 GMT
We need to preserve this logic:

 > -      <xsl:choose>
 > -       <xsl:when test="$spaceless-filenames">
 > -          <xsl:value-of select="concat(translate($href,',''),'.html')"/>
 > -       </xsl:when>
 > -       <xsl:otherwise>
 > -          <xsl:value-of select="concat('view.do?page=',$href)"/>
 > -       </xsl:otherwise>
 > -      </xsl:choose>

I don't know why, but when submitting this file back to cocoon, they 
requested that the default href of links be view.do?page=  But of course 
that doesn't make any sense in forrest.  So the $spaceless-filenames 
parameter is used.


crossley@apache.org wrote:
> Author: crossley
> Date: Tue Sep 14 23:34:47 2004
> New Revision: 46087
> 
> Modified:
>    forrest/trunk/src/core/context/resources/chaperon/stylesheets/wiki2xdoc.xsl
> Log:
> A link in a JSPWiki document is expressed by the syntax [XXX|YYY]
> where YYY is the "href" value of the link. If YYY contains spaces to
> either side (e.g. [ XXX | YYY ]) the link might not be rendered
> correctly. This patch corrects this problem by "normalizing" whitespace.
> Also it partly simplifies the template for processing wiki links, using
> a new template "convertLinks". 
> Submitted by: Fabio Rinaldi
> Issue: FOR-291
> 
> 
> Modified: forrest/trunk/src/core/context/resources/chaperon/stylesheets/wiki2xdoc.xsl
> ==============================================================================
> --- forrest/trunk/src/core/context/resources/chaperon/stylesheets/wiki2xdoc.xsl	(original)
> +++ forrest/trunk/src/core/context/resources/chaperon/stylesheets/wiki2xdoc.xsl	Tue Sep
14 23:34:47 2004
> @@ -183,53 +183,46 @@
>      <xsl:variable name="href" select="substring-before(substring-after(.,'|'),']')"/>
>      <xsl:variable name="text" select="substring-after(substring-before(.,'|'),'[')"/>
>  
> -    <xsl:choose>
> -     <xsl:when test="string(number($href)) != 'NaN'">
> -      <link href="#{$href}">
> -       <xsl:value-of select="$text"/>
> -      </link>
> -     </xsl:when>
> -     <xsl:when test="contains($href,'.png') or contains($href,'.jpg') or contains($href,'.gif')">
> -      <img src="{$href}" alt="{$text}"/>
> -     </xsl:when>
> -     <xsl:when test="contains($href,':') or contains($href,'.')">
> -      <link href="{$href}">
> -       <xsl:value-of select="$text"/>
> -      </link>
> -     </xsl:when>
> -     <xsl:otherwise>
> -      <link>
> -       <xsl:attribute name="href">
> -      <xsl:choose>
> -       <xsl:when test="$spaceless-filenames">
> -          <xsl:value-of select="concat(translate($href,' ',''),'.html')"/>
> -       </xsl:when>
> -       <xsl:otherwise>
> -          <xsl:value-of select="concat('view.do?page=',$href)"/>
> -       </xsl:otherwise>
> -      </xsl:choose>
> -       </xsl:attribute>
> -       <xsl:value-of select="$text"/>
> -      </link>
> -     </xsl:otherwise>
> -    </xsl:choose>
> +	<xsl:call-template name="convertLink">
> +	  <xsl:with-param name="href0" select="$href"/>
> +	  <xsl:with-param name="text" select="$text"/>
> +	</xsl:call-template>
>  
>     </xsl:when>
>     <xsl:otherwise>
>      <xsl:variable name="href" select="substring(.,2,string-length(.)-2)"/>
>      
> +	<xsl:call-template name="convertLink">
> +	  <xsl:with-param name="href0" select="$href"/>
> +	  <xsl:with-param name="text" select="$href"/>
> +	</xsl:call-template>
> +
> +   </xsl:otherwise>
> +  </xsl:choose>
> + </xsl:template>
> +
> +
> +  <xsl:template name="convertLink" >
> +    <xsl:param name="href0"/>
> +    <xsl:param name="text"/>
> +    
> +    <xsl:variable name="href">
> +      <xsl:value-of
> +	select="normalize-space($href0)"/>
> +    </xsl:variable>
> +
>      <xsl:choose>
>       <xsl:when test="string(number($href)) != 'NaN'">
>        <link href="#{$href}">
> -       [<xsl:value-of select="$href"/>]
> +       <xsl:value-of select="$text"/>   <!-- $href -->
>        </link>
>       </xsl:when>
>       <xsl:when test="contains($href,'.png') or contains($href,'.jpg') or contains($href,'.gif')">
> -      <img src="{$href}" alt="{$href}"/>
> +      <img src="{$href}" alt="{$text}"/> <!-- $href -->
>       </xsl:when>
>       <xsl:when test="contains($href,':') or contains($href,'.')">
>        <link href="{$href}">
> -       <xsl:value-of select="$href"/>
> +       <xsl:value-of select="$text"/> <!-- $href -->
>        </link>
>       </xsl:when>
>       <xsl:otherwise>
> @@ -244,14 +237,12 @@
>         </xsl:otherwise>
>        </xsl:choose>
>         </xsl:attribute>
> -       <xsl:value-of select="$href"/>
> +       <xsl:value-of select="$text"/> <!-- $href -->
>        </link>
>       </xsl:otherwise>
>      </xsl:choose>
> +  </xsl:template>
>  
> -   </xsl:otherwise>
> -  </xsl:choose>
> - </xsl:template>
>  
>   <xsl:template match="st:anchor" >
>    <p>


-- 
Dave Brondsema : dave@brondsema.net
http://www.splike.com : programming
http://csx.calvin.edu : student org
http://www.brondsema.net : personal

Mime
View raw message