]> gitweb.factorcode.org Git - factor.git/commitdiff
Fixing relative link prefix lossage
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 22 Sep 2008 05:36:07 +0000 (00:36 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 22 Sep 2008 05:36:07 +0000 (00:36 -0500)
basis/furnace/alloy/alloy.factor
basis/html/components/components.factor
extra/webapps/wiki/view.xml
extra/webapps/wiki/wiki-common.xml
extra/webapps/wiki/wiki.factor

index f27c7d67c024f08752d03cf3fd0ecfb54a4c474a..684c4aef4cff6fe01da112bcdb792ebe404050c7 100644 (file)
@@ -20,10 +20,11 @@ IN: furnace.alloy
         <check-form-submissions>
     ] call ;
 
-: state-classes { session aside conversation permit user } ; inline
+: state-classes { session aside conversation permit } ; inline
 
 : init-furnace-tables ( -- )
-    state-classes ensure-tables ;
+    state-classes ensure-tables
+    user ensure-table ;
 
 : start-expiring ( db params -- )
     '[
index 6965cb582a03a1801fba5ca3055d63aea3e4a638..9ade6691575859f632d65639ffce1238e4ca21ce 100644 (file)
@@ -144,7 +144,7 @@ M: code render*
     [ string-lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ;
 
 ! Farkup component
-TUPLE: farkup no-follow disable-images ;
+TUPLE: farkup no-follow disable-images parsed ;
 
 : string>boolean ( string -- boolean )
     {
@@ -154,9 +154,11 @@ TUPLE: farkup no-follow disable-images ;
 
 M: farkup render*
     [
+        nip
         [ no-follow>> [ string>boolean link-no-follow? set ] when* ]
-        [ disable-images>> [ string>boolean disable-images? set ] when* ] bi
-        drop string-lines "\n" join write-farkup
+        [ disable-images>> [ string>boolean disable-images? set ] when* ]
+        [ parsed>> string>boolean [ (write-farkup) ] [ write-farkup ] if ]
+        tri
     ] with-scope ;
 
 ! Inspector component
index 5136e4945db32e866c91f4565df3371081821988..e3774bbe0b063c6250e041a10fa6f262f6a5f56e 100644 (file)
@@ -5,7 +5,7 @@
        <t:title><t:label t:name="title" /></t:title>
 
        <div class="description">
-               <t:html t:name="html" />
+               <t:farkup t:name="parsed" t:parsed="true" />
        </div>
 
        <p>
index 6a90f0d0de98384ee8e44debd07c747bf5addb20..628485955ef51fecbba0d7d9c8ea56bede746bea 100644 (file)
@@ -20,7 +20,7 @@
                                                                </t:a>
                                                        </h2>
 
-                                                       <t:html t:name="html" />
+                                                       <t:farkup t:name="parsed" t:parsed="true" />
                                                </t:bind>
                                        </div>
                                </td>
@@ -59,7 +59,7 @@
                                <td colspan="2">
                                        <t:bind t:name="footer">
                                                <small>
-                                                       <t:html t:name="html" />
+                                                       <t:farkup t:name="parsed" t:parsed="true" />
                                                </small>
                                        </t:bind>
                                </td>
index 7165f169c55c2ffcbdea9fd58a9ca8a99e682c53..420d71d26b1c72751f7f3808567ddefa8c77d173 100644 (file)
@@ -47,7 +47,7 @@ article "ARTICLES" {
 
 : <article> ( title -- article ) article new swap >>title ;
 
-TUPLE: revision id title author date content html description ;
+TUPLE: revision id title author date content parsed description ;
 
 revision "REVISIONS" {
     { "id" "ID" INTEGER +db-assigned-id+ }
@@ -55,7 +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
+    { "parsed" "PARSED" FACTOR-BLOB +not-null+ } ! Farkup AST
     { "description" "DESCRIPTION" TEXT }
 } define-persistent
 
@@ -73,7 +73,7 @@ M: revision feed-entry-url id>> revision-url ;
     revision new swap >>id ;
 
 : compute-html ( revision -- )
-    dup content>> convert-farkup >>html drop ;
+    dup content>> parse-farkup >>parsed drop ;
 
 : validate-title ( -- )
     { { "title" [ v-one-line ] } } validate-params ;
@@ -348,6 +348,9 @@ M: revision feed-entry-url id>> revision-url ;
     "Contents" latest-revision [ "contents" [ from-object ] nest-form ] when*
     "Footer" latest-revision [ "footer" [ from-object ] nest-form ] when* ;
 
+: init-relative-link-prefix ( -- )
+    URL" $wiki/view/" adjust-url present relative-link-prefix set ;
+
 : <wiki> ( -- dispatcher )
     wiki new-dispatcher
         <main-article-action> "" add-responder
@@ -367,7 +370,7 @@ M: revision feed-entry-url id>> revision-url ;
         <list-changes-feed-action> "changes.atom" add-responder
         <delete-action> "delete" add-responder
     <boilerplate>
-        [ init-sidebars ] >>init
+        [ init-sidebars init-relative-link-prefix ] >>init
         { wiki "wiki-common" } >>template ;
 
 : init-wiki ( -- )