cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/chaperon/samples/wiki selftest.txt
Date Tue, 25 May 2004 08:06:19 GMT
crossley    2004/05/25 01:06:19

  Modified:    .        status.xml
               src/blocks/chaperon/samples/grammars wiki.grm
               src/blocks/chaperon/samples/stylesheets wiki2xdoc.xsl
               src/blocks/chaperon/samples/wiki selftest.txt
  Log:
  Improvements for Chaperon JSPWiki to xdocs conversion:
  * handle nested bullet lists (number lists already supported)
  * if 'name' parameter is specified, use it as title (and add spaces between
  WikiWords) instead of first section title
  * handle images with alt text
  * 'spaceless-filenames' parameter will squash out spaces in relative links
  * fix anchors to use 'id' instead of 'name'
  * emphasize anchors a bit
  * selftest.txt tests for lists and tables
  * more known issues listed in selftest.txt
  Issue: 28809
  Submitted by: Dave Brondsema
  
  Revision  Changes    Path
  1.339     +13 -1     cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.338
  retrieving revision 1.339
  diff -u -r1.338 -r1.339
  --- status.xml	25 May 2004 07:28:26 -0000	1.338
  +++ status.xml	25 May 2004 08:06:19 -0000	1.339
  @@ -211,6 +211,18 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +   <action dev="DC" type="update" fixes-bug="28809" due-to="Dave Brondsema">
  +   Improvements for Chaperon JSPWiki to xdocs conversion:
  +   * handle nested bullet lists (number lists already supported)
  +   * if 'name' parameter is specified, use it as title (and add spaces between
  +   WikiWords) instead of first section title
  +   * handle images with alt text
  +   * 'spaceless-filenames' parameter will squash out spaces in relative links
  +   * fix anchors to use 'id' instead of 'name'
  +   * emphasize anchors a bit
  +   * selftest.txt tests for lists and tables
  +   * more known issues listed in selftest.txt
  +   </action>
      <action dev="CZ" type="update">
        Remove deprecated class AbstractSessionComponent from session block.
      </action>
  
  
  
  1.11      +34 -7     cocoon-2.1/src/blocks/chaperon/samples/grammars/wiki.grm
  
  Index: wiki.grm
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/chaperon/samples/grammars/wiki.grm,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- wiki.grm	16 Mar 2004 01:44:22 -0000	1.10
  +++ wiki.grm	25 May 2004 08:06:19 -0000	1.11
  @@ -47,7 +47,9 @@
   
   %right hardbreak "(\r(\n?) | \n) (\r(\n?) | \n)+";
   
  -%token bulleteditem "\*+";
  +%token bulleted1item "\*";
  +%token bulleted2item "\*\*";
  +%token bulleted3item "\*\*\*";
   
   %token numbered1item "#";
   %token numbered2item "##";
  @@ -122,7 +124,7 @@
     ;
   
   paragraph 
  -  : bulletedlist
  +  : bulletedlist1
     | numberedlist1
     | textsequence
     | line 
  @@ -131,15 +133,38 @@
     | table
     ;
   
  -bulletedlist 
  -  : bulletedlist bulletedlistitem 
  -  | bulletedlistitem              
  +bulletedlist1 
  +  : bulletedlist1 bulletedlistitem1 
  +  | bulletedlistitem1               
  +  | bulletedlist1 bulletedlist2     
  +  | bulletedlist2                   
  +  ;
  +
  +bulletedlistitem1 
  +  : bulleted1item textsequence
  +  ;
  +
  +bulletedlist2 
  +  : bulletedlist2 bulletedlistitem2 
  +  | bulletedlistitem2               
  +  | bulletedlist2 bulletedlist3     
  +  | bulletedlist3                   
  +  ; 
  +
  +bulletedlistitem2 
  +  : bulleted2item textsequence
     ;
   
  -bulletedlistitem 
  -  : bulleteditem textsequence
  +bulletedlist3 
  +  : bulletedlist3 bulletedlistitem3 
  +  | bulletedlistitem3               
  +  ; 
  +
  +bulletedlistitem3 
  +  : bulleted3item textsequence
     ;
   
  +
   numberedlist1 
     : numberedlist1 numberedlistitem1 
     | numberedlistitem1               
  @@ -174,6 +199,8 @@
   table
     : tablehead softbreak tablerows
     | tablehead softbreak tablerows softbreak
  +  | tablerows
  +  | tablerows softbreak
     ;
   
   tablehead
  
  
  
  1.11      +120 -10   cocoon-2.1/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl
  
  Index: wiki2xdoc.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- wiki2xdoc.xsl	6 Mar 2004 02:25:33 -0000	1.10
  +++ wiki2xdoc.xsl	25 May 2004 08:06:19 -0000	1.11
  @@ -25,9 +25,72 @@
                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:choose>
  +       <xsl:when test="$name">
  +        <xsl:call-template name="splitString">
  +         <xsl:with-param name="restOfString" select="$name"/>
  +        </xsl:call-template>
  +       </xsl:when>
  +       <xsl:otherwise>
  +        <xsl:value-of select="st:document/st:section/st:title/st:textsequence"/>
  +       </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>
   
    <xsl:template match="st:section">
  @@ -118,13 +181,26 @@
          <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 href="view.do?page={$href}">
  +      <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>
  @@ -149,7 +225,17 @@
         </link>
        </xsl:when>
        <xsl:otherwise>
  -      <link href="view.do?page={$href}">
  +      <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>
  @@ -160,16 +246,19 @@
    </xsl:template>
   
    <xsl:template match="st:anchor" >
  +  <p>
     <xsl:choose>
      <xsl:when test="contains(.,'|')">
  -    <anchor name="{substring-before(substring-after(.,'|#'),']')}">
  +    <anchor id="{substring-before(substring-after(.,'|#'),']')}">
        <xsl:value-of select="substring-after(substring-before(.,'|'),'[')"/>
       </anchor>
      </xsl:when>
      <xsl:otherwise>
  -    <anchor name="{substring(.,3,string-length(.)-3)}"/>
  +    <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:emblock">
  @@ -180,21 +269,42 @@
     <strong><xsl:value-of select="st:text"/></strong><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 match="st:bulletedlist1" mode="paragraph">
  +  <ul>
  +   <xsl:apply-templates select="st:bulletedlistitem1|st:bulletedlist2"/>
  +  </ul>
    </xsl:template>
  -
  - <xsl:template match="st:bulletedlist" mode="paragraph">
  + 
  + <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:bulletedlistitem"/>
  +   <xsl:apply-templates select="st:bulletedlistitem2|st:bulletedlist3"/>
     </ul>
    </xsl:template>
   
  - <xsl:template match="st:bulletedlistitem" >
  + <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" mode="paragraph">
     <ol>
  
  
  
  1.5       +60 -18    cocoon-2.1/src/blocks/chaperon/samples/wiki/selftest.txt
  
  Index: selftest.txt
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/chaperon/samples/wiki/selftest.txt,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- selftest.txt	23 Feb 2004 16:19:16 -0000	1.4
  +++ selftest.txt	25 May 2004 08:06:19 -0000	1.5
  @@ -1,13 +1,15 @@
  -This wiki document is a self-describing test of the Cocoon Chaperon wiki grammar. Reading
what follows 
  -should tell you if the tests are successful.
  +This wiki document is a self-describing test of the Cocoon Chaperon wiki grammar. Reading
what follows should tell you if the tests are successful.
   
  -The page http://wiki.cocoondev.org/Wiki.jsp?page=ChaperonTestPage should be kept in sync
with this so as 
  -to be able to compare the output of both, as the Chaperon wiki grammar is meant to emulate
the JSPWiki syntax 
  -used by the Cocoon wiki.
  +The document in the Cocoon Samples is at: src/blocks/chaperon/samples/wikitest/selftest.txt
   
  -The "content", "parser-output" and "xdoc" views can be used to check the various stages
of parsing and conversion.
  +The document in the Cocoon Wiki is at: http://wiki.cocoondev.org/Wiki.jsp?page=ChaperonTestPage
  +
  +Both documents should be synchronised, so as to be able to compare the output of both,
as the Chaperon wiki grammar is meant to emulate the JSPWiki syntax used by the Cocoon wiki.
  +
  +In the Cocoon Samples, the "content", "parser-output" and "xdoc" views can be used to check
the various stages of parsing and conversion.
   
   Lines like -- THIS TEXT -- are comments about this test, they must appear as is.
  +----
   
   -- 0. CURRENT RESULTS --
   
  @@ -19,8 +21,15 @@
   * 0.1 This bullet list is invisible in the html output if there is no section title (3
bangs) before it
   * 1.1 Headings must be used in the usual order (big contains medium contains small), otherwise
unpredictable results can occur due to the conversion from the linear wiki model to the nested
xdocs model. 
   * 5.1 relative link points to wiki.cocoondev.org (but is it by design?)
  +* 8.3 Spaces must surround in tables
  +* Can't end a line with \ or two \s
  +* Can't have empty table cells (pipe is parsed the same as two pipes)
  +* Can't have a list item with no text
  +* Can't have a line consisting of a single space
  +* ;term:ex not supported
   
  --- 1.HEADINGS --
  +
  +-- 1. HEADINGS --
   
   Test 1.1 headings in the usual order (from big to small): below you should see 3 headings,
big, medium, small:
   
  @@ -30,7 +39,7 @@
   
   ! small heading #1
   
  -Test 1.2 same headings with text in-between
  +Test 1.2 same headings with text in between
   
   !!! big heading #2
   Text after big heading.
  @@ -44,7 +53,7 @@
   !!! new big heading
   The above heading starts a new section in the xdocs version of this document.
   
  --- 2.NUMBERED LISTS --
  +-- 2. NUMBERED LISTS --
   
   Test 2.1 This should be followed by a list that counts from one to four:
   # one
  @@ -52,7 +61,14 @@
   # three
   #four
   
  --- 3.BULLET LISTS --
  +Test 2.2 This should have indentation depths of 1, 2, 3, 2, 1
  +# one
  +## two
  +### three
  +## two
  +# one
  +
  +-- 3. BULLET LISTS --
   
   Test 3.1 This should be followed by four bullet points:
   * Bullet one
  @@ -61,19 +77,24 @@
   * Bullet four
   
   Test 3.2 This should be followed by two bullet points with one line of text in between:
  -
   * Bullet one, JSPWiki ends bullet at newline so this is the end.
   and this is not part of bullet one.
   * But this is bullet two.
   
   Test 3.3 This should be followed by 4 bullet points with no text in between them:
  -
   * Bullet 3.3.1, adding some ''italic'' should not break the bullet point in two
   * Bullet 3.3.2, adding some __bold__ should not break the bullet point in two
   * Bullet 3.3.3, adding some {{monospaced}} should not break the bullet point in two
   * Bullet 3.3.4, adding some ''italic'', __bold__, and {{monospaced}} should not break the
bullet point in two
   
  --- 4.TEXT ATTRIBUTES --
  +Test 3.4 This should have indentation depths of 1, 2, 3, 2, 1
  +* one
  +** two
  +*** three
  +** two
  +* one
  +
  +-- 4. TEXT ATTRIBUTES --
   
   Test 4.1 The words __bold__, ''italic'' and {{monospaced}} in this phrase should be displayed
with the corresponding attributes.
   
  @@ -90,17 +111,17 @@
   	}
   }}}
   
  --- 5.LINKS --
  +-- 5. LINKS --
   
  -Test 5.1 Here a link to this same page: [wikitest.html]
  +Test 5.1 Here is a link to this same page: [wikitest.html]
   
   Test 5.2 Link to cocoon.apache.org: [http://cocoon.apache.org]
   
  -Test 5.3 A link to another wiki site [Text formating rules|rules].
  +Test 5.3 A link to another wiki page [Text formating rules|rules].
   
  --- 6.MISCELLANEOUS --
  +-- 6. MISCELLANEOUS --
   
  -Test 6.1 This paragraph should be followed by a horizontal ruler line.
  +Test 6.1 This paragraph should be followed by a horizontal rule line.
   ----
   
   Test 6.2 There should be a line break between the words one and two that follow: 
  @@ -112,3 +133,24 @@
   Test 7.1 In this paragraph all
   words should be
   followed by a single space.
  +
  +-- 8. TABLES --
  +
  +Test 8.1 Table with header
  +
  +|| Header 1 || Header 2
  +| data | more data
  +| foo | bar
  +| abc | 123
  +
  +Test 8.2 Table without header
  +
  +| asdf | asdf | asdf
  +| fdsa | qwer | 789
  +| yuiop | zxcv | 00001
  +
  +Test 8.3 Table without spaces around pipe delimiters
  +
  +|asdf|asdf|asdf
  +|fdsa|qwer|789
  +|yuiop|zxcv|00001
  
  
  

Mime
View raw message