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
: <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+ }
{ "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
: <revision> ( id -- revision )
revision new swap >>id ;
+: compute-html ( revision -- )
+ dup content>> convert-farkup >>html drop ;
+
: validate-title ( -- )
{ { "title" [ v-one-line ] } } validate-params ;
[ 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>