Author: vgritsenko Date: Mon Oct 4 15:18:45 2004 New Revision: 53756 Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/link.xlex cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/wiki.grm cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/error2html.xsl cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/pattern2link.xsl cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/wiki/selftest.txt cocoon/branches/BRANCH_2_1_X/status.xml Log: Sync chaperon block with trunk
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/link.xlex ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/link.xlex (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/link.xlex Mon Oct 4 15:18:45 2004 @@ -66,6 +66,88 @@ </concat> </lexeme> + <lexeme symbol="cssurl"> + <concat> + <group> + <concat> + <cstring content="u"/> + <cstring content="r"/> + <cstring content="l"/> + </concat> + + <concat minOccurs="0" maxOccurs="*"> + <cstring content=" "/> + </concat> + + <concat> + <cstring content="("/> + </concat> + + <concat minOccurs="0" maxOccurs="*"> + <cstring content=" "/> + </concat> + + <concat minOccurs="0" maxOccurs="1"> + <cstring content="'"/> + </concat> + </group> + + <group> + <concat minOccurs="0"> + <cstring content="/"/> + <cclass minOccurs="0" maxOccurs="*"> + <cinterval min="A" max="Z"/> + <cinterval min="a" max="z"/> + <cinterval min="0" max="9"/> + <cset content="._-:"/> + </cclass> + </concat> + + <cclass minOccurs="0" maxOccurs="*"> + <cinterval min="A" max="Z"/> + <cinterval min="a" max="z"/> + <cinterval min="0" max="9"/> + <cset content="._-:/"/> + </cclass> + + <concat minOccurs="0"> + <cstring content="?"/> + <cclass minOccurs="0" maxOccurs="*"> + <cinterval min="A" max="Z"/> + <cinterval min="a" max="z"/> + <cinterval min="0" max="9"/> + <cset content="._-:/?"/> + </cclass> + </concat> + + <concat minOccurs="0"> + <cstring content="#"/> + <cclass minOccurs="0" maxOccurs="*"> + <cinterval min="A" max="Z"/> + <cinterval min="a" max="z"/> + <cinterval min="0" max="9"/> + <cset content="._-:/?#"/> + </cclass> + </concat> + </group> + + <group> + <concat minOccurs="0" maxOccurs="1"> + <cstring content="'"/> + </concat> + + <concat minOccurs="0" maxOccurs="*"> + <cstring content=" "/> + </concat> + + <concat> + <cstring content=")"/> + </concat> + </group> + + </concat> + </lexeme> + <lexeme symbol="email"> <concat> <concat> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/wiki.grm ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/wiki.grm (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/grammars/wiki.grm Mon Oct 4 15:18:45 2004 @@ -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 Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/error2html.xsl ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/error2html.xsl (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/error2html.xsl Mon Oct 4 15:18:45 2004 @@ -15,7 +15,7 @@ limitations under the License. --> -<!-- CVS $Id: error2html.xsl,v 1.2 2004/03/06 02:25:33 antonio Exp $ --> +<!-- CVS $Id$ --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" @@ -75,7 +75,7 @@ <p> If you think you found a bug, please report it to - <a href="http://nagoya.apache.org/bugzilla/">Apache's Bugzilla</a>; + <a href="http://issues.apache.org/bugzilla/">Apache's Bugzilla</a>; a message will automatically be sent to the developer mailing list and you'll be kept in contact automatically with the further progress on that bug. </p> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/pattern2link.xsl ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/pattern2link.xsl (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/pattern2link.xsl Mon Oct 4 15:18:45 2004 @@ -32,6 +32,10 @@ </a> </xsl:template> + <xsl:template match="lex:[EMAIL PROTECTED]'cssurl']"> + <a href="{lex:group[3]}"><xsl:value-of select="lex:group[1]"/></a> + </xsl:template> + <xsl:template match="@*|*|text()|processing-instruction()" priority="-1"> <xsl:copy> <xsl:apply-templates select="@*|*|text()|processing-instruction()"/> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/stylesheets/wiki2xdoc.xsl Mon Oct 4 15:18:45 2004 @@ -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) >= 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> Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/wiki/selftest.txt ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/wiki/selftest.txt (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/chaperon/samples/wiki/selftest.txt Mon Oct 4 15:18:45 2004 @@ -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 cwiki grammar. Comparing what follows should show you that 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/wiki/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 JSPWiki is at: http://www.jspwiki.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. + +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,14 @@ * 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 +38,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 +52,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 +60,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 +76,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 +110,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.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 formatting rules|TextFormattingRules]. --- 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 +132,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 Modified: cocoon/branches/BRANCH_2_1_X/status.xml ============================================================================== --- cocoon/branches/BRANCH_2_1_X/status.xml (original) +++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Oct 4 15:18:45 2004 @@ -461,6 +461,21 @@ <action dev="AG" type="update"> Updated Groovy to 1.0-beta5, qdox to 1.4 and util.concurrent to 1.3.4. </action> + <action dev="DC" type="update" fixes-bug="28809" due-to="Dave Brondsema"> + Chaperon block: Improvements for Chaperon JSPWiki to xdocs conversion: + <ul> + <li>Handle nested bullet lists (number lists already supported)</li> + <li>If 'name' parameter is specified, use it as title (and add spaces between + WikiWords) instead of first section title</li> + <li>Handle images with alt text</li> + <li>'spaceless-filenames' parameter will squash out spaces in relative + links</li> + <li>Fix anchors to use 'id' instead of 'name'</li> + <li>Emphasize anchors a bit</li> + <li>selftest.txt tests for lists and tables</li> + <li>More known issues listed in selftest.txt</li> + </ul> + </action> <action dev="VG" type="add"> Added instrumentation support to ContinuationsManager. </action>