Fixing relative link prefix lossage

db4
Slava Pestov 2008-09-22 00:36:07 -05:00
parent cae42362d9
commit 7fb336ef18
5 changed files with 18 additions and 12 deletions

View 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 -- )
'[

View 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

View 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>

View 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>

View 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 ( -- )