forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 43648 - in forrest/trunk: . src/core/context src/core/context/resources/chaperon/grammars src/core/context/resources/chaperon/stylesheets
Date Fri, 10 Sep 2004 07:49:01 GMT
Author: crossley
Date: Fri Sep 10 00:49:00 2004
New Revision: 43648

Added:
   forrest/trunk/src/core/context/resources/chaperon/grammars/moinwiki.grm   (contents, props
changed)
   forrest/trunk/src/core/context/resources/chaperon/stylesheets/moinwiki2xdoc.xsl   (contents,
props changed)
Modified:
   forrest/trunk/src/core/context/forrest.xmap
   forrest/trunk/status.xml
Log:
Chaperon grammar for minimal MoinMoin Wiki to Forrest xdocs transformation.
Source documents use the *.moinwiki filename extension.
due-to="Fabio Rinaldi" fixes-bug="FOR-268"


Modified: forrest/trunk/src/core/context/forrest.xmap
==============================================================================
--- forrest/trunk/src/core/context/forrest.xmap	(original)
+++ forrest/trunk/src/core/context/forrest.xmap	Fri Sep 10 00:49:00 2004
@@ -292,7 +292,20 @@
             </map:transform>
             <map:serialize type="xml-document"/>
           </map:match>
-        </map:when>        
+        </map:when>
+        <map:when test="{project:content.xdocs}{uri}.moinwiki">
+          <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
+            <map:generate type="text2xml" src="{project:content.xdocs}{1}{2}.moinwiki"
/>
+            <map:transform type="lexer"   src="cocoon:/moinwiki.xlex"/>
+            <map:transform type="parser"  src="cocoon:/moinwiki.xgrm"/>
+            <map:transform type="xsltc" 
+              src="{forrest:context}/resources/chaperon/stylesheets/moinwiki2xdoc.xsl">
+              <map:parameter name="name" value="{2}" />
+              <map:parameter name="spaceless-filenames" value="true"/>
+            </map:transform>
+            <map:serialize type="xml-document"/>
+          </map:match>
+        </map:when>
         <map:when test="{project:content.xdocs}{uri}.txt">
           <map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
             <map:generate type="text2xml" src="{project:content.xdocs}{1}{2}.txt" />

Added: forrest/trunk/src/core/context/resources/chaperon/grammars/moinwiki.grm
==============================================================================
--- (empty file)
+++ forrest/trunk/src/core/context/resources/chaperon/grammars/moinwiki.grm	Fri Sep 10 00:49:00
2004
@@ -0,0 +1,563 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+%token htitle5 "=====";
+%token htitle4 "====";
+%token htitle3 "===";
+%token htitle2 "==";
+%token htitle1 "=";
+
+%token emitem "''";
+%token strongitem "'''";
+%token ulitem "__";
+%token subitem "\,\,"; 
+%token supitem "\^";
+%token typewriteritem "`";
+
+
+/* various smileys */
+/*
+%token sm1 ":)";
+%token sm2 ";)";
+%token sm3 ":D";
+ ;) :D {1} {de} {OK} (./)
+*/
+
+%token source "\{\{\{ (\}{0,2}[^\}])* \}\}\}";
+
+
+
+%token rule10 "^\-\-\-\-\-\-\-\-\-\-";
+%token rule9 "^\-\-\-\-\-\-\-\-\-";
+%token rule8 "^\-\-\-\-\-\-\-\-";
+%token rule7 "^\-\-\-\-\-\-\-";
+%token rule6 "^\-\-\-\-\-\-";
+%token rule5 "^\-\-\-\-\-";
+%token rule4 "^\-\-\-\-";
+
+%token rule0  "^\-+";
+
+
+
+
+
+%token tablecolumnitem "\ *\|\|";
+
+
+/* TO CHECK */
+/*%token anchor "\[( [^\[\|\]]* \| )? # [^\[\|\]]* \]"; */
+/* %token link   "\[( [^\[\|\]]* \| )?   [^\[\|\]]* \]"; */
+
+/*
+%token anchor "\[( [^\[\ \]]* \| )? # [^\[\]]* \]";
+%token link   "\[( [^\[\ \]]* \| )?   [^\[\]]* \]";
+*/
+
+%token anchor  "\[#( [^\[\ \]]* ) (\ +[^\[\]]*)?\]";
+%token link   "\[( [^\[\ \]]* ) (\ +[^\[\]]*)?\]";
+
+%token xmarkup "\<[^\>]*\>";
+
+%token comment "^##.*";
+
+/*
+%token text  "([^\ \t\n\r\[\{\}\|\*\\\-_!#'] | _[^_\n\r] | \{[^\{\n\r] | \}[^\}\n\r] | '[^'\n\r]

+                                             | \[\[ | \\[^\\\n\r] | \-{1,3}[^\-\n\r]?)
+              ([^    \n\r\[\{\}\|\\\-_']     | _[^_\n\r] | \{[^\{\n\r] | \}[^\}\n\r] | '[^'\n\r]

+                                             | \[\[ | \\[^\\\n\r] | \-{1,3}[^\-\n\r]? | \|[^\|\
\t])*";
+*/
+
+%token text  "([^\ \t\n\r\[\{\}\|\*\\\-\^\,_#'`=] 
+		| \,[^\,]
+		| _[^_] 
+		| \{[^\{] 
+		| \}[^\}] 
+		| '[^'] 
+                | \[\[ 
+		| \\[^\\] 
+		| \-{1,3}[^\-\n\r])
+              ([^    \n\r\[\{\}\|\\\-\^\,_'`=]     
+		| \,[^\,]
+		| _[^_] 
+		| \{[^\{] 
+		| \}[^\}] 
+		| '[^'] 
+                | \[\[ 
+		| \\[^\\] 
+		| \-{1,3}[^\-\n\r] 
+		| \|[^\|\ \t])*";
+
+
+%right softbreak "\r(\n?) | \n";
+
+%right break "\\\\";
+
+%right hardbreak "(\r(\n?) | \n) (\r(\n?) | \n)+";
+
+/* lists */
+
+%token bulleted1item "^\ \*";
+%token bulleted2item "^\ \ \*";
+%token bulleted3item "^\ \ \ \*";
+
+%token numbered1item "^\ 1\.";
+%token numbered2item "^\ \ 1\.";
+%token numbered3item "^\ \ \ 1\.";
+
+%token lettered1item "^\ a\.";
+%token lettered2item "^\ \ a\.";
+%token lettered3item "^\ \ \ a\.";
+
+%token roman1item "^\ i\.";
+%token roman2item "^\ \ i\.";
+%token roman3item "^\ \ \ i\.";
+
+%token plain1item "^\ ";
+%token plain2item "^\ \ ";
+%token plain3item "^\ \ \ ";
+
+%ignore "[\ \t]+";
+
+%start document;
+
+%%
+
+document 
+  : paragraphs sections
+  | sections
+  | paragraphs
+  ;  
+
+sections
+  : sections1
+  | sections2
+  | sections3
+  | sections4
+  | sections5
+  ;
+
+sections1
+  : section1 
+  | sections1 section1
+  ;
+
+section1
+  : title1 sections2
+  | title1 paragraphs 
+  | title1 paragraphs sections2
+  | title1 
+  ;
+
+sections2
+  : section2
+  | sections2 section2
+  ;
+
+section2
+  : title2 paragraphs 
+  | title2 paragraphs sections3
+  | title2 sections3
+  | title2 
+  ;
+
+sections3
+  : section3
+  | sections3 section3
+  ;
+
+section3
+  : title3 paragraphs 
+  | title3 paragraphs sections4
+  | title3 sections4
+  | title3
+  ;
+
+sections4
+  : section4
+  | sections4 section4
+  ;
+
+section4
+  : title4 paragraphs 
+  | title4 paragraphs sections5 
+  | title4 sections5 
+  | title4
+  ;
+
+sections5
+  : section5
+  | sections5 section5
+  ;
+
+section5
+  : title5 paragraphs 
+  | title5
+  ;
+
+title1
+  : htitle1 textsequence htitle1 softbreak
+  | htitle1 textsequence htitle1 hardbreak
+  ;
+
+title2
+  : htitle2 textsequence htitle2 softbreak
+  | htitle2 textsequence htitle2 hardbreak
+  ;
+
+title3
+  : htitle3 textsequence htitle3 softbreak
+  | htitle3 textsequence htitle3 hardbreak
+  ;
+
+title4
+  : htitle4 textsequence htitle4 softbreak
+  | htitle4 textsequence htitle4 hardbreak
+  ;
+
+title5
+  : htitle5 textsequence htitle5 softbreak
+  | htitle5 textsequence htitle5 hardbreak
+  ;
+
+paragraphs  
+  : paragraphs paragraph hardbreak
+  | paragraphs paragraph 
+  | paragraph hardbreak
+  | paragraph
+  ;
+
+paragraph 
+  : alist1
+  | textsequence
+  | rulen
+  | rulen softbreak
+  | plainNitem source %prec softbreak
+  | plainNitem source softbreak
+  | source %prec softbreak
+  | source softbreak
+  | comment softbreak
+  | table
+  | plainNitem table
+  ;
+
+
+rulen
+  : rule4
+  | rule5
+  | rule6
+  | rule7
+  | rule8
+  | rule9
+  | rule10
+  | rule0
+  ;
+
+
+alist1
+  : bulletedlist1
+  | letteredlist1
+  | romanlist1
+  | numberedlist1
+  | plainlist1
+  ;
+
+alist2
+  : bulletedlist2
+  | letteredlist2
+  | romanlist2
+  | numberedlist2
+  | plainlist2
+  ;
+
+alist3
+  : bulletedlist3
+  | letteredlist3
+  | romanlist3
+  | numberedlist3
+  | plainlist3
+  ;
+
+/* bulleted list */
+
+bulletedlist1 
+  : bulletedlist1 bulletedlistitem1 
+  | bulletedlistitem1               
+  | bulletedlist1 alist2     
+  | alist2                   
+  ;
+
+
+bulletedlist2 
+  : bulletedlist2 bulletedlistitem2 
+  | bulletedlistitem2               
+  | bulletedlist2 alist3     
+  | alist3                   
+  ; 
+
+bulletedlist3 
+  : bulletedlist3 bulletedlistitem3 
+  | bulletedlistitem3               
+  ; 
+
+
+bulletedlistitem1 
+  : bulleted1item textsequence
+  ;
+
+bulletedlistitem2 
+  : bulleted2item textsequence
+  ;
+
+bulletedlistitem3 
+  : bulleted3item textsequence
+  ;
+
+/* lettered list */
+
+letteredlist1 
+  : letteredlist1 letteredlistitem1 
+  | letteredlistitem1               
+  | letteredlist1 alist2     
+  | alist2                   
+  ;
+
+letteredlist2 
+  : letteredlist2 letteredlistitem2 
+  | letteredlistitem2               
+  | letteredlist2 alist3     
+  | alist3                   
+  ; 
+
+letteredlist3 
+  : letteredlist3 letteredlistitem3 
+  | letteredlistitem3               
+  ; 
+
+
+letteredlistitem1 
+  : lettered1item textsequence
+  ;
+
+letteredlistitem2 
+  : lettered2item textsequence
+  ;
+
+letteredlistitem3 
+  : lettered3item textsequence
+  ;
+
+/* roman list */
+
+romanlist1 
+  : romanlist1 romanlistitem1 
+  | romanlistitem1               
+  | romanlist1 alist2     
+  | alist2                   
+  ;
+
+romanlist2 
+  : romanlist2 romanlistitem2 
+  | romanlistitem2               
+  | romanlist2 alist3     
+  | alist3                   
+  ; 
+
+romanlist3 
+  : romanlist3 romanlistitem3 
+  | romanlistitem3               
+  ; 
+
+
+romanlistitem1 
+  : roman1item textsequence
+  ;
+
+romanlistitem2 
+  : roman2item textsequence
+  ;
+
+romanlistitem3 
+  : roman3item textsequence
+  ;
+
+
+/* numbered list */
+
+numberedlist1 
+  : numberedlist1 numberedlistitem1 
+  | numberedlistitem1               
+  | numberedlist1 alist2     
+  | alist2                   
+  ;
+
+numberedlist2 
+  : numberedlist2 numberedlistitem2 
+  | numberedlistitem2               
+  | numberedlist2 alist3     
+  | alist3                   
+  ; 
+
+numberedlist3 
+  : numberedlist3 numberedlistitem3 
+  | numberedlistitem3               
+  ; 
+
+
+numberedlistitem1 
+  : numbered1item textsequence
+  ;
+
+numberedlistitem2 
+  : numbered2item textsequence
+  ;
+
+numberedlistitem3 
+  : numbered3item textsequence
+  ;
+
+/* plain list */
+
+plainlist1 
+  : plainlistitem1 plainlist1
+  | plainlistitem1               
+  | plainlist1 alist2     
+  | alist2                   
+  ;
+
+plainlist2 
+  : plainlist2 plainlistitem2 
+  | plainlistitem2               
+  | plainlist2 alist3     
+  | alist3                   
+  ; 
+
+plainlist3 
+  : plainlist3 plainlistitem3 
+  | plainlistitem3               
+  ; 
+
+
+plainlistitem1 
+  : plain1item textsequence
+  ;
+
+plainlistitem2 
+  : plain2item textsequence
+  ;
+
+plainlistitem3 
+  : plain3item textsequence
+  ;
+
+plainNitem
+  : plain1item
+  | plain2item
+  | plain3item
+  ;
+
+/* table */
+
+table
+  : tablerows
+  ;
+
+tablerows
+  : tablerow softbreak tablerows
+  | tablerow softbreak
+  | tablerow hardbreak
+  ;
+
+tablerow
+  : tablecolumns tablecolumnitem
+  ;
+
+tablecolumns
+  : tablecolumns tablecolumn
+  | tablecolumn 
+  ;
+
+tablecolumn
+  : tablecolumnitems textblock
+  | tablecolumnitems xmarkup textblock
+  ;
+  
+tablecolumnitems
+  : tablecolumnitem tablecolumnitems   
+  | tablecolumnitem
+  ;
+
+textsequence 
+  : textsequence textblock softbreak
+  | textsequence textblock 
+  | textblock softbreak  
+  | textblock
+  | textsequence textblock break
+  | textblock break
+  ;
+
+/*
+isequence
+  : isequence iblock softbreak
+  | isequence iblock 
+  | iblock softbreak  
+  | iblock
+  | isequence iblock break
+  | iblock break
+  ; 
+*/
+
+textblock 
+  : link
+  | anchor
+  | strongblock                      
+  | emblock 
+  | ulblock           
+  | codeblock
+  | supblock
+  | subblock
+  | xmarkup
+  | text
+  ;
+
+/*
+iblock
+  : indent textblock
+  ;
+*/
+
+emblock 
+  : emitem text emitem
+  ;
+
+ulblock 
+  : ulitem text ulitem
+  ;
+
+strongblock 
+  : strongitem text strongitem
+  ;
+
+supblock 
+  : supitem text supitem
+  ;
+
+subblock 
+  : subitem text subitem
+  ;
+
+codeblock 
+  : typewriteritem text typewriteritem
+  ;

Added: forrest/trunk/src/core/context/resources/chaperon/stylesheets/moinwiki2xdoc.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/src/core/context/resources/chaperon/stylesheets/moinwiki2xdoc.xsl	Fri Sep
10 00:49:00 2004
@@ -0,0 +1,562 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:st="http://chaperon.sourceforge.net/schema/syntaxtree/2.0"
+                exclude-result-prefixes="st">
+
+ <xsl:output indent="yes" 
+             method="html"
+             doctype-public="-//APACHE//DTD Documentation V1.1//EN"
+             doctype-system="document-v11.dtd"
+             cdata-section-elements="source"/>
+
+ <xsl:param name="name" select="''"/>
+ <xsl:param name="spaceless-filenames" select="''"/>
+
+ <xsl:template name="splitString">
+    <xsl:param name="restOfString"/>
+    
+    <xsl:variable name="uppercase">(ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+    <xsl:variable name="currentLetter" select="substring($restOfString,1,1)"/>
+    
+    <xsl:choose>
+        <xsl:when test="contains($restOfString, '(') or contains($restOfString,' ')">
+            <xsl:value-of select="$restOfString"/>
+        </xsl:when>
+        <xsl:when test="string-length($restOfString) &gt;= 2">
+        <!-- there's a possibility it needs to be split -->
+        <xsl:choose>
+            <xsl:when test="contains($uppercase,$currentLetter)">
+                <xsl:variable name="followingLetter" select="substring($restOfString,2,1)"/>
+                <xsl:if test="not(contains($uppercase,$followingLetter))">
+                    <xsl:text> </xsl:text>
+                </xsl:if>
+                <xsl:value-of select="$currentLetter"/>
+                
+                <xsl:call-template name="splitString">
+                    <xsl:with-param name="restOfString" select="substring($restOfString,2)"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- current letter is lower-case - just spit it out -->
+                <xsl:value-of select="$currentLetter"/>
+                <xsl:call-template name="splitString">
+                    <xsl:with-param name="restOfString" select="substring($restOfString,2)"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+        <!-- end of string - just write the remainder -->
+        <xsl:value-of select="$restOfString"/>
+        </xsl:otherwise>
+    </xsl:choose>
+ </xsl:template>
+
+
+
+  <xsl:template match="st:output">
+    <document>  
+      <header>  
+	<title>
+	  <xsl:variable name="title" select="st:document/st:sections1/st:section/st:title/st:textsequence"/>
+	  <xsl:choose>
+	    <xsl:when test="$title">
+	      <xsl:value-of select="$title"/>
+	    </xsl:when>
+	    <xsl:otherwise>
+<!-- 	      <xsl:when test="$name"> -->
+		<xsl:call-template name="splitString">
+		  <xsl:with-param name="restOfString" select="$name"/>
+		</xsl:call-template>
+<!-- 	      </xsl:when> -->
+	    </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:sections"/>
+      </body>  
+    </document>
+  </xsl:template>
+
+
+  <xsl:template match="st:sections">
+    <xsl:apply-templates select="st:sections5/st:section5"/>
+    <xsl:apply-templates select="st:sections4/st:section4"/>
+    <xsl:apply-templates select="st:sections3/st:section3"/>
+    <xsl:apply-templates select="st:sections2/st:section2"/>
+    <xsl:apply-templates select="st:sections1/st:section1"/>
+  </xsl:template>
+
+ <xsl:template match="st:section1">
+  <section>
+   <title><xsl:value-of select="st:title1/st:textsequence"/></title>  
+   <xsl:apply-templates select="st:paragraphs/st:paragraph/*|st:sections2/st:section2"
/>
+  </section>
+ </xsl:template>
+
+
+ <xsl:template match="st:section2">
+  <section>
+   <title><xsl:value-of select="st:title2/st:textsequence"/></title>
+   <xsl:apply-templates select="st:paragraphs/st:paragraph/*|st:sections3/st:section3"
/>
+  </section>
+ </xsl:template>
+
+ <xsl:template match="st:section3">
+  <section>
+   <title><xsl:value-of select="st:title3/st:textsequence"/></title>
+   <xsl:apply-templates select="st:paragraphs/st:paragraph/*|st:sections4/st:section4"
/>
+  </section>
+ </xsl:template>
+
+ <xsl:template match="st:section4">
+  <section>
+   <title><xsl:value-of select="st:title4/st:textsequence"/></title>
+   <xsl:apply-templates select="st:paragraphs/st:paragraph/*|st:sections5/st:section5"
/>
+  </section>
+ </xsl:template>
+
+ <xsl:template match="st:section5">
+  <section>
+   <title><xsl:value-of select="st:title5/st:textsequence"/></title>
+   <xsl:apply-templates select="st:paragraphs/st:paragraph/*" />
+  </section>
+ </xsl:template>
+
+ <xsl:template match="st:source">
+  <source>
+   <xsl:value-of select="substring(.,4,string-length(.)-6)"/>
+  </source>
+ </xsl:template>
+
+ <xsl:template match="st:textsequence">
+  <p>
+   <xsl:apply-templates select="st:textblock/*|st:break"/>
+  </p>
+ </xsl:template>
+
+ <xsl:template match="st:line" mode="paragraph">
+  <p>--------------------------------------------------------------------------------</p>
+ </xsl:template>
+
+ <xsl:template match="st:table" mode="paragraph"> 
+  <table>
+   <xsl:apply-templates select="st:tablehead|st:tablerows/st:tablerow"/>
+  </table>
+ </xsl:template>
+
+ <xsl:template match="st:tablehead"> 
+  <tr>
+   <xsl:apply-templates select="st:tabletitle"/>
+  </tr>
+ </xsl:template>
+
+ <xsl:template match="st:tabletitle">
+  <th>
+   <xsl:apply-templates select="st:textblock/*"/>
+  </th>
+ </xsl:template>
+
+ <xsl:template match="st:tablerow">
+  <tr>
+   <xsl:apply-templates select="st:tablecolumns/st:tablecolumn"/>
+  </tr>
+ </xsl:template>
+
+ <xsl:template match="st:tablecolumn">
+  <td>
+   <xsl:apply-templates select="st:textblock/*"/>
+  </td>
+ </xsl:template>
+
+ <xsl:template match="st:etablecolumn">
+  <td>
+  </td>
+ </xsl:template>
+
+ <xsl:template match="st:text">
+  <xsl:value-of select="."/><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:break">
+  <br/>
+ </xsl:template>
+
+ <xsl:template match="st:link">
+  <xsl:choose>
+   <xsl:when test="contains(.,' ')">
+
+    <xsl:variable name="text" select="substring-before(substring-after(.,' '),']')"/>
+    <xsl:variable name="href0" select="substring-after(substring-before(.,' '),'[')"/>
+
+<!-- 	just a temporary solution until wiki identifiers are available in forrest -->
+	<xsl:variable name="href">
+	  <xsl:choose>
+	    <xsl:when test="substring($href0,1,5) = 'wiki:'">
+	      <xsl:value-of select="concat('http://',substring($href0,6))"/>
+	    </xsl:when>     
+	    <xsl:otherwise>
+	      <xsl:value-of select="$href0"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+    <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:when>
+   <xsl:otherwise>
+    <xsl:variable name="href0" select="substring(.,2,string-length(.)-2)"/>
+    
+<!-- 	just a temporary solution until wiki identifiers are available in forrest -->
+	<xsl:variable name="href">
+	  <xsl:choose>
+	    <xsl:when test="substring($href0,1,5) = 'wiki:'">
+	      <xsl:value-of select="concat('http://',substring($href0,6))"/>
+	    </xsl:when>     
+	    <xsl:otherwise>
+	      <xsl:value-of select="$href0"/>
+	    </xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+
+    <xsl:choose>
+     <xsl:when test="string(number($href)) != 'NaN'">
+      <link href="#{$href}">
+       [<xsl:value-of select="$href"/>]
+      </link>
+     </xsl:when>
+     <xsl:when test="contains($href,'.png') or contains($href,'.jpg') or contains($href,'.gif')">
+      <img src="{$href}" alt="{$href}"/>
+     </xsl:when>
+     <xsl:when test="contains($href,':') or contains($href,'.')">
+      <link href="{$href}">
+       <xsl:value-of select="$href"/>
+      </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="$href"/>
+      </link>
+     </xsl:otherwise>
+    </xsl:choose>
+
+   </xsl:otherwise>
+  </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="st:anchor" >
+  <p>
+  <xsl:choose>
+   <xsl:when test="contains(.,' ')">
+    <anchor id="substring-after(substring-before(.,' '),'[#')">
+     <xsl:value-of select="substring-before(substring-after(.,' '),']')"/>
+    </anchor>
+   </xsl:when>
+   <xsl:otherwise>
+    <em><xsl:value-of select="substring(.,3,string-length(.)-3)"/>:</em>
+    <anchor id="{substring(.,3,string-length(.)-3)}"/>
+   </xsl:otherwise>
+  </xsl:choose>
+  </p>
+ </xsl:template>
+
+ <xsl:template match="st:comment">
+ </xsl:template>
+
+ <xsl:template match="st:ipara">
+   <strong>
+      <xsl:value-of select="st:textblock/st:text"/><xsl:text> </xsl:text>
+   </strong>
+ </xsl:template>
+
+ <xsl:template match="st:ulblock">
+  <xsl:value-of select="st:text"/><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:emblock">
+  <em><xsl:value-of select="st:text"/></em><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:strongblock">
+  <strong><xsl:value-of select="st:text"/></strong><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:supblock">
+  <sup><xsl:value-of select="st:text"/></sup><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:subblock">
+  <sub><xsl:value-of select="st:text"/></sub><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:codeblock">
+  <code><xsl:value-of select="st:text"/></code><xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="st:alist1">
+   <xsl:apply-templates select="st:bulletedlist1"/>
+   <xsl:apply-templates select="st:letteredlist1"/>
+   <xsl:apply-templates select="st:numberedlist1"/>
+   <xsl:apply-templates select="st:romanlist1"/>
+   <xsl:apply-templates select="st:plainlist1"/>
+ </xsl:template>
+
+ <xsl:template match="st:alist2">
+   <xsl:apply-templates select="st:bulletedlist2"/>
+   <xsl:apply-templates select="st:letteredlist2"/>
+   <xsl:apply-templates select="st:numberedlist2"/>
+   <xsl:apply-templates select="st:romanlist2"/>
+   <xsl:apply-templates select="st:plainlist2"/>
+ </xsl:template>
+
+ <xsl:template match="st:alist3">
+   <xsl:apply-templates select="st:bulletedlist3"/>
+   <xsl:apply-templates select="st:letteredlist3"/>
+   <xsl:apply-templates select="st:numberedlist3"/>
+   <xsl:apply-templates select="st:romanlist3"/>
+   <xsl:apply-templates select="st:plainlist3"/>
+ </xsl:template>
+
+ <xsl:template match="st:bulletedlist1">
+  <ul>
+   <xsl:apply-templates select="st:bulletedlistitem1|st:alist2"/>
+  </ul>
+ </xsl:template>
+ 
+ <xsl:template match="st:bulletedlistitem1" >
+   <li>
+    <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+   </li>
+ </xsl:template>
+ 
+ <xsl:template match="st:bulletedlist2" >
+  <ul>
+   <xsl:apply-templates select="st:bulletedlistitem2|st:alist3"/>
+  </ul>
+ </xsl:template>
+
+ <xsl:template match="st:bulletedlistitem2" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:bulletedlist3" >
+  <ul>
+   <xsl:apply-templates select="st:bulletedlistitem3"/>
+  </ul>
+ </xsl:template>
+    
+ <xsl:template match="st:bulletedlistitem3" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+
+ <xsl:template match="st:numberedlist1">
+  <ol type="1">
+   <xsl:apply-templates select="st:numberedlistitem1|st:alist2"/>
+  </ol>
+ </xsl:template>
+
+ <xsl:template match="st:numberedlistitem1" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:numberedlist2" >
+  <ol type="1">
+   <xsl:apply-templates select="st:numberedlistitem2|st:alist3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:numberedlistitem2" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:numberedlist3" >
+  <ol type="1">
+   <xsl:apply-templates select="st:numberedlistitem3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:numberedlistitem3" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:letteredlist1">
+  <ol type="a">
+   <xsl:apply-templates select="st:letteredlistitem1|st:alist2"/>
+  </ol>
+ </xsl:template>
+
+ <xsl:template match="st:letteredlistitem1" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:letteredlist2" >
+  <ol type="a">
+   <xsl:apply-templates select="st:letteredlistitem2|st:alist3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:letteredlistitem2" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:letteredlist3" >
+  <ol type="a">
+   <xsl:apply-templates select="st:letteredlistitem3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:letteredlistitem3" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:romanlist1">
+  <ol type="i">
+   <xsl:apply-templates select="st:romanlistitem1|st:alist2"/>
+  </ol>
+ </xsl:template>
+
+ <xsl:template match="st:romanlistitem1" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:romanlist2" >
+  <ol type="i">
+   <xsl:apply-templates select="st:romanlistitem2|st:alist3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:romanlistitem2" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:romanlist3" >
+  <ol type="i">
+   <xsl:apply-templates select="st:romanlistitem3"/>
+  </ol>
+ </xsl:template>
+    
+ <xsl:template match="st:romanlistitem3" >
+  <li>
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+  </li>
+ </xsl:template>
+
+ <xsl:template match="st:plainlist1">
+  <ul>
+   <xsl:apply-templates select="st:plainlistitem1|st:alist2"/>
+  </ul>
+ </xsl:template>
+
+ <xsl:template match="st:plainlistitem1" >
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+ </xsl:template>
+
+ <xsl:template match="st:plainlist2" >
+  <ul>
+   <xsl:apply-templates select="st:plainlistitem2|st:alist3"/>
+  </ul>
+ </xsl:template>
+    
+ <xsl:template match="st:plainlistitem2" >
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+ </xsl:template>
+
+ <xsl:template match="st:plainlist3" >
+  <ul>
+   <xsl:apply-templates select="st:plainlistitem3"/>
+  </ul>
+ </xsl:template>
+    
+ <xsl:template match="st:plainlistitem3" >
+   <xsl:apply-templates select="st:textsequence/st:textblock/*"/>
+ </xsl:template>
+
+ <xsl:template match="st:rulen" >
+    <p><xsl:apply-templates select="*"/></p>
+ </xsl:template>
+
+ <xsl:template match="@*|*|text()|processing-instruction()" priority="-1">
+  <xsl:copy>
+   <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
+  </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>

Modified: forrest/trunk/status.xml
==============================================================================
--- forrest/trunk/status.xml	(original)
+++ forrest/trunk/status.xml	Fri Sep 10 00:49:00 2004
@@ -49,6 +49,10 @@
         Added new document to facilitate
         <link href="site:upgrading_06">upgrading to v0.6</link>
       </action>
+      <action dev="DC" type="add" context="core" due-to="Fabio Rinaldi" fixes-bug="FOR-268">
+        Chaperon grammar for minimal MoinMoin Wiki to Forrest xdocs
+        transformation. Source documents use the *.moinwiki filename extension.
+      </action>
       <action dev="NKB" type="add" context="core">
         Requesting linkmap.html Forrest now renderes the site.xml 
         file as a table of contents.
@@ -74,7 +78,7 @@
         linking mechanism.
       </action>
       <action dev="DC" type="fix" context="core" due-to="Fabio Rinaldi">
-        Re-write the Chaperon grammar for CWiki to address ambiguity with
+        Re-write the Chaperon grammar for JSPWiki to address ambiguity with
         paragraphs and sub-sections.
       </action>
       <action dev="DB" type="add" context="plugins">

Mime
View raw message