]> gitweb.factorcode.org Git - factor.git/commitdiff
Wiki: cache Farkup HTML output
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 8 Sep 2008 06:11:27 +0000 (01:11 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 8 Sep 2008 06:11:27 +0000 (01:11 -0500)
extra/webapps/wiki/view.xml
extra/webapps/wiki/wiki-common.xml
extra/webapps/wiki/wiki.factor

index 38d9d39d558777b8f1e7e7a23222feca7121f7a4..5136e4945db32e866c91f4565df3371081821988 100644 (file)
@@ -5,7 +5,7 @@
        <t:title><t:label t:name="title" /></t:title>
 
        <div class="description">
-               <t:farkup t:name="content" />
+               <t:html t:name="html" />
        </div>
 
        <p>
index dea79670a31a51b39641865d7c6352752a0d4065..89a0f1770668a02a6b2036e5d67238ed429d7ea5 100644 (file)
@@ -41,7 +41,7 @@
                                                        </t:a>
                                                </h2>
                
-                                               <t:farkup t:name="content" />
+                                               <t:html t:name="html" />
                                        </t:bind>
                                </td>
                        </t:if>
@@ -52,7 +52,7 @@
                                <td>
                                        <t:bind t:name="footer">
                                                <small>
-                                                       <t:farkup t:name="content" />
+                                                       <t:html t:name="html" />
                                                </small>
                                        </t:bind>
                                </td>
index 380f41cf9782c239440ccc45d110dde353d86571..5f679be431047746be105fa0c0d66aea02f64938 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors kernel hashtables calendar random assocs
 namespaces splitting sequences sorting math.order present
 io.files io.encodings.ascii
-syndication
+syndication farkup
 html.components html.forms
 http.server
 http.server.dispatchers
@@ -47,7 +47,7 @@ article "ARTICLES" {
 
 : <article> ( title -- article ) article new swap >>title ;
 
-TUPLE: revision id title author date content description ;
+TUPLE: revision id title author date content html description ;
 
 revision "REVISIONS" {
     { "id" "ID" INTEGER +db-assigned-id+ }
@@ -55,6 +55,7 @@ revision "REVISIONS" {
     { "author" "AUTHOR" { VARCHAR 256 } +not-null+ } ! uid
     { "date" "DATE" TIMESTAMP +not-null+ }
     { "content" "CONTENT" TEXT +not-null+ }
+    { "html" "HTML" TEXT +not-null+ } ! Farkup converted to HTML
     { "description" "DESCRIPTION" TEXT }
 } define-persistent
 
@@ -71,6 +72,9 @@ M: revision feed-entry-url id>> revision-url ;
 : <revision> ( id -- revision )
     revision new swap >>id ;
 
+: compute-html ( revision -- )
+    dup content>> convert-farkup >>html drop ;
+
 : validate-title ( -- )
     { { "title" [ v-one-line ] } } validate-params ;
 
@@ -144,11 +148,13 @@ M: revision feed-entry-url id>> revision-url ;
     [ title>> ] [ id>> ] bi article boa insert-tuple ;
 
 : add-revision ( revision -- )
+    [ compute-html ]
     [ insert-tuple ]
     [
         dup title>> <article> select-tuple
         [ amend-article ] [ add-article ] if*
-    ] bi ;
+    ]
+    tri ;
 
 : <edit-article-action> ( -- action )
     <page-action>