cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r292989 - in /cocoon/whiteboard/example-apps/bricks-cms: ./ lib/textile4j/ lib/textile4j/textile4j-1.20/ src/cocoon/webapp/bricks-cms/admin/document-editor/flow/ src/cocoon/webapp/bricks-cms/admin/document-editor/forms/ src/cocoon/webapp/br...
Date Sat, 01 Oct 2005 14:39:52 GMT
Author: bdelacretaz
Date: Sat Oct  1 07:39:33 2005
New Revision: 292989

URL: http://svn.apache.org/viewcvs?rev=292989&view=rev
Log:
Wiki text support added, using textile4j

Added:
    cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/
    cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/
    cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-LICENSE.txt
    cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-with-source.jar
  (with props)
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/example-text.js
    cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/
    cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/TextParser.java
    cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/
    cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/TextileTextParserImpl.java
Modified:
    cocoon/whiteboard/example-apps/bricks-cms/STATUS.TXT
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/document-editor.js
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/forms/document-template.xml
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/view/document.jx.xml
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/static-content/resources/css/bricks-cms.css
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/xslt/page-to-html.xsl
    cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/common/component-manager.js
    cocoon/whiteboard/example-apps/bricks-cms/src/misc/hivemind/hivemodule.xml

Modified: cocoon/whiteboard/example-apps/bricks-cms/STATUS.TXT
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/STATUS.TXT?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/STATUS.TXT (original)
+++ cocoon/whiteboard/example-apps/bricks-cms/STATUS.TXT Sat Oct  1 07:39:33 2005
@@ -4,9 +4,10 @@
 ===========================================================================
 
 The current revision allows BricksDocuments to be edited and displayed
-in a very simple way.
+in a very simple way, using (a subset of) the Textile wiki syntax.
 
-It has been tested with the Cocoon 2.1.7 release on macosx, JDK 1.4.2.
+It has been tested with the Cocoon 2.1.7 release on macosx, JDK 1.4.2, 
+and a few other environments, see http://wiki.apache.org/cocoon/BricksCms.
 
 Documents are stored in an embedded Derby relational database.
 

Added: cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-LICENSE.txt
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-LICENSE.txt?rev=292989&view=auto
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-LICENSE.txt
(added)
+++ cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-LICENSE.txt
Sat Oct  1 07:39:33 2005
@@ -0,0 +1,39 @@
+Textile4J BSD-like License, as found in the source code 
+downloaded from http://sourceforge.net/projects/textile4j
+
+ Java implementation of Textism's Textile Humane Web Text Generator
+ Portions  Copyright (c) 2003 Mark Lussier, All Rights Reserved
+
+ --------------------------------------------------------------------------------
+
+ Textile is Copyright (c) 2003, Dean Allen, www.textism.com, All rights reserved
+ The  origional Textile can be found at http://www.textism.com/tools/textile
+
+ _______________
+ TEXTILE LICENSE
+
+ Redistribution and use in source and binary forms, with or without
+ modifcation, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ Neither the name Textile nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.

Added: cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-with-source.jar
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-with-source.jar?rev=292989&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/whiteboard/example-apps/bricks-cms/lib/textile4j/textile4j-1.20/textile4j-1.20-with-source.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/document-editor.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/document-editor.js?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/document-editor.js
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/document-editor.js
Sat Oct  1 07:39:33 2005
@@ -18,6 +18,7 @@
 
 cocoon.load("context://bricks-cms/common/component-manager.js");
 cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+cocoon.load("context://bricks-cms/admin/document-editor/flow/example-text.js");
 
 var DOC_CLASS = Packages.org.apache.cocoon.apps.bricks.cms.data.BricksDocument;
 
@@ -35,7 +36,7 @@
         // create new document
         document = objectStore.createNew(DOC_CLASS);
         document.title = "(new document)";
-        document.content = "(no content yet)";
+        document.content = get_exampleText();
 
     } else {
         // retrieve document for editing, fail it not found
@@ -78,10 +79,15 @@
     if(document == null) {
         throw new java.lang.Exception("BricksDocument having id '" + docId + "' not found");
     }
+    
+    var wikiXMLizable = get_wikiParser().parse(document.content);
 
     cocoon.sendPage(
         displayURI,
-        { "document":document }
+        { 
+        		"document":document,
+        		"wikiText":wikiXMLizable
+        }
     );
 }
 

Added: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/example-text.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/example-text.js?rev=292989&view=auto
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/example-text.js
(added)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/flow/example-text.js
Sat Oct  1 07:39:33 2005
@@ -0,0 +1,52 @@
+/*
+    Copyright 2005 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.
+*/
+
+// get example text to use when creating a new document
+function get_exampleText() {
+	var txt = ""
+	+ "h1. Textile structured text example\n"
+	+ "\n"
+	+ "h2. Basics\n"
+	+ "\n"
+	+ "As in most wiki syntaxes, a blank line separates paragraphs.\n"
+	+ "\n"
+	+ "This is our second paragraph.\n"
+	+ "\n"
+	+ "h2. Lists\n"
+	+ "\n"
+	+ "Lists can also be used, either bulleted:\n"
+	+ "* one\n"
+	+ "* two\n"
+	+ "* two and a half\n"
+	+ "* three, last item of the bulleted list\n"
+	+ "\n"
+	+ "or numbered:\n"
+	+ "# Item one\n"
+	+ "# Item two\n"
+	+ "# Item three\n"
+	+ "\n"
+	+ "h2. Formatting\n"
+	+ "\n"
+	+ "Simple formatting like _emphasis_ and *strong* can be used, there are also ??citations
and more??.\n"
+	+ "\n"
+	+ "bq. Blockquotes are also supported.\n"
+	+ "\n"
+	+ "h2. Links\n"
+	+ "\n"
+	+ "Links are entered by specifying the link text and URL, like \"textile\":http://textism.com/tools/textile/
 or \"Cocoon\":http://cocoon.apache.org .\n"
+	;
+	return txt;
+}
\ No newline at end of file

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/forms/document-template.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/forms/document-template.xml?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/forms/document-template.xml
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/forms/document-template.xml
Sat Oct  1 07:39:33 2005
@@ -108,7 +108,13 @@
 
         </table>
       </div>
-    </ft:form-template>
+     <div class="note">
+      	Textile syntax (TODO indicate exactly which constructs are supported)
+      	can be used in the content field,
+      	see <a target="_new" href="http://textism.com/tools/textile/">http://textism.com/tools/textile/</a>
+      	for examples.
+      </div>
+     </ft:form-template>
   </content>
 
 </page>

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/view/document.jx.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/view/document.jx.xml?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/view/document.jx.xml
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/document-editor/view/document.jx.xml
Sat Oct  1 07:39:33 2005
@@ -41,7 +41,9 @@
         <b>#{document/id}</b>,
         you might want to note this ID for further testing.
       </p>
-      <p>#{document/content}</p>
+      <div class="content">
+	      #{wikiText}
+      </div>
       <div class="note">
         created: #{document/created}
         <br/>

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/static-content/resources/css/bricks-cms.css
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/static-content/resources/css/bricks-cms.css?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/static-content/resources/css/bricks-cms.css
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/static-content/resources/css/bricks-cms.css
Sat Oct  1 07:39:33 2005
@@ -21,7 +21,26 @@
 }
 
 h1 {
+	font-size:140%;
     border-bottom: solid blue 1px;
+	font-weight:bold;
+}
+
+h2 {
+	font-size:120%;
+	font-weight:bold;
+}
+
+h3 {
+	font-size:120%;
+	font-weight:normal;
+}
+
+.pageTitle {
+	font-size:140%;
+	font-variant: small-caps;
+	text-align: right;
+    border-bottom: solid gray 1px;
 }
 
 .note {
@@ -41,4 +60,8 @@
     display: inline;
     padding: 0 0.4em;
     border-left: solid #CCCCCC 1px;
-}
\ No newline at end of file
+}
+
+td {
+	vertical-align: top;
+}	
\ No newline at end of file

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/xslt/page-to-html.xsl
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/xslt/page-to-html.xsl?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/xslt/page-to-html.xsl
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/admin/xslt/page-to-html.xsl
Sat Oct  1 07:39:33 2005
@@ -70,5 +70,10 @@
       <xsl:apply-templates mode="copy-content"/>
     </div>
   </xsl:template>
+  
+  <!-- parsed wiki text, no special processing for now, but do not copy the element -->
+  <xsl:template match="parsed-text" mode="copy-content">
+  	<xsl:apply-templates mode="copy-content"/>
+  </xsl:template>
 
 </xsl:stylesheet>

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/common/component-manager.js
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/common/component-manager.js?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/common/component-manager.js
(original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/cocoon/webapp/bricks-cms/common/component-manager.js
Sat Oct  1 07:39:33 2005
@@ -33,3 +33,10 @@
     var objectStore = cm.getService(Packages.org.apache.cocoon.apps.bricks.cms.objectstore.ObjectStore);
     return objectStore;
 }
+
+// get the wiki parser via the component manager
+function get_wikiParser() {
+	var cm = get_cm();
+	var wikiParser = cm.getService(Packages.org.apache.cocoon.apps.bricks.cms.wikiparser.TextParser);
+	return wikiParser;
+}

Added: cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/TextParser.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/TextParser.java?rev=292989&view=auto
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/TextParser.java
(added)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/TextParser.java
Sat Oct  1 07:39:33 2005
@@ -0,0 +1,28 @@
+/*
+    Copyright 2005 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.
+*/
+
+package org.apache.cocoon.apps.bricks.cms.wikiparser;
+
+import org.apache.excalibur.xml.sax.XMLizable;
+
+/** Parse text (usually with a wiki parser) and return an
+ * 	XMLizable so that the parsed result can be written
+ * 	to a ContentHandler
+ */
+public interface TextParser {
+	/** return an XMLizable which parses given text */
+	XMLizable parse(String text) throws Exception;
+}

Added: cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/TextileTextParserImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/TextileTextParserImpl.java?rev=292989&view=auto
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/TextileTextParserImpl.java
(added)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/java/org/apache/cocoon/apps/bricks/cms/wikiparser/impl/TextileTextParserImpl.java
Sat Oct  1 07:39:33 2005
@@ -0,0 +1,65 @@
+/*
+    Copyright 2005 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.
+*/
+
+package org.apache.cocoon.apps.bricks.cms.wikiparser.impl;
+
+import org.apache.cocoon.apps.bricks.cms.wikiparser.TextParser;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.apache.excalibur.xml.sax.XMLizable;
+import org.apache.cocoon.xml.StringXMLizable;
+import net.sf.textile4j.Textile;
+
+/** TextParser which uses textile4j for the wiki syntax.
+ * 
+ * 	Unfortunately textile4j (like most wiki parsers) outputs
+ * 	a String, which must be parsed to generate proper XML. It
+ * 	would be better if the parser could write directly to 
+ * 	a ContentHandler.
+ * 
+ * 	For now we use a StringXMLizable for this - if the wiki
+ * 	parsed might return non-well-formed XHTML we could use
+ * 	NekoHTML to parse its output.
+ */
+public class TextileTextParserImpl implements TextParser,XMLizable {
+
+	private final String input;
+	public static final String OUTPUT_ELEMENT = "parsed-text";
+	
+	/** service constructor, used by Hivemind */
+	public TextileTextParserImpl() {
+		input = null;
+	}
+	
+	/** instance constructor used in parse() */
+	private TextileTextParserImpl(String text) {
+		input = text;
+	}
+	
+	/** factory method, returns a new instance initialized to parse given text */ 
+	public XMLizable parse(String text) throws Exception {
+		return new TextileTextParserImpl(text);
+	}
+	
+	/** parse text and output to contentHandler */
+	public void toSAX(ContentHandler contentHandler) throws SAXException {
+		if(input==null) throw new IllegalArgumentException("null input, cannot parse");
+		final String parsedText = new Textile().process(input);
+		final String startTag = "<" + OUTPUT_ELEMENT + " source='" + getClass().getName() +
"'>";
+		final String endTag = "</" + OUTPUT_ELEMENT + ">";
+		new StringXMLizable(startTag + parsedText + endTag).toSAX(contentHandler);
+	}
+}

Modified: cocoon/whiteboard/example-apps/bricks-cms/src/misc/hivemind/hivemodule.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/example-apps/bricks-cms/src/misc/hivemind/hivemodule.xml?rev=292989&r1=292988&r2=292989&view=diff
==============================================================================
--- cocoon/whiteboard/example-apps/bricks-cms/src/misc/hivemind/hivemodule.xml (original)
+++ cocoon/whiteboard/example-apps/bricks-cms/src/misc/hivemind/hivemodule.xml Sat Oct  1
07:39:33 2005
@@ -51,4 +51,12 @@
     </invoke-factory>
   </service-point>
 
+  <!-- wiki parser -->
+  <service-point id="WikiParser" interface="org.apache.cocoon.apps.bricks.cms.wikiparser.TextParser">
+    <invoke-factory service-id="hivemind.BuilderFactory">
+      <construct class="org.apache.cocoon.apps.bricks.cms.wikiparser.impl.TextileTextParserImpl"
autowire-services="true">
+      </construct>
+    </invoke-factory>
+  </service-point>
+  
 </module>



Mime
View raw message