forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabio Rinaldi" <rina...@ifi.unizh.ch>
Subject Re: wiki monospace: minor bug?
Date Wed, 18 Aug 2004 12:26:05 GMT

Hi Dave,

thanks for pointing me to the files. Adding support for the
'monospaced' construction is pretty trivial, as this is already
defined in "wiki.grm". It is enough to add the following to
"wiki2xdoc.xsl":

271a272,275
>  <xsl:template match="st:codeblock">
>   <code><xsl:value-of select="st:text"/></code><xsl:text> </xsl:text>
>  </xsl:template>
>

However, adding support for definition lists is far more complex as
this is not already defined in "wiki.grm" (at least, I could not spot
it). Besides, I do not see a great need for them. 

There are other things that one might wish to have, for instance
something that I really miss is the possibility of defining a title
for a wiki page. As far as I can tell, currently the name of the file
is taken as the title of the page. This might not always be the
desired behaviour. 

I have found a way to add support for this feature by modifying the
template for "st:output" in "wiki2xdoc.xsl" as follows:

  <xsl:template match="st:output">
    <document>  
      <header>  
	<title>
	  <xsl:variable name="title" select="st:document/st:section/st:title/st:textsequence"/>
	  <xsl:choose>
	    <xsl:when test="$title">
	      <xsl:value-of select="$title"/>
	    </xsl:when>
	    <xsl:otherwise>
		<xsl:call-template name="splitString">
		  <xsl:with-param name="restOfString" select="$name"/>
		</xsl:call-template>
	    </xsl:otherwise>
	  </xsl:choose>
	</title>  
      </header>  
      <body>
	<xsl:apply-templates select="st:document/st:paragraphs/st:paragraph/*" mode="paragraph"/>
 
	<xsl:apply-templates select="st:document/st:section"/>
      </body>  
    </document>
  </xsl:template>


With this change, if there is a top-level title (!!! TITLE ) at the 
start of the wiki document, it will be taken as the title of the
page. If not, the name of the file will be used. Notice that I am
assuming (contrary to the original version), that the variable '$name'
is always passed to this template. 

Let me know if this is useful.

Best,
Fabio

Dave Brondsema writes:
 > On Mon, 16 Aug 2004, Fabio Rinaldi wrote:
 > 
 > >
 > > Hi,
 > >
 > > according to the documentation at:
 > >
 > > http://forrest.apache.org/docs/wiki-sample.html
 > >
 > > {{text}}   = prints 'text' in monospaced font.
 > >
 > > However, I could not get this to work. This specification seems to be
 > > completely ignored: in the output I get the brackets and the text
 > > without any special font effect.
 > >
 > 
 > You're right.  The chaperon parser is used to parse the wiki files
 > (JSPWiki format) and nobody the transformations are not as complete as
 > JSPWiki itself.  Definition lists are also not supported and whitespace
 > matters a lot more than in JSPWiki.  If you'd like to try your hand at
 > adding support, these are the files in 0.6 (from SVN) to use:
 > 
 > src/core/context/resources/chaperon/grammars/wiki.grm
 > src/core/context/resources/chaperon/stylesheets/wiki2xdoc.xsl
 > 

Mime
View raw message