Add some simple markup inheritance

db4
Slava Pestov 2008-06-15 04:56:35 -05:00
parent 2b413f1eb7
commit 52297bcfeb
3 changed files with 35 additions and 6 deletions

View File

@ -1,19 +1,26 @@
! Copyright (c) 2008 Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel namespaces
html.templates html.templates.chloe
html.forms
html.templates
html.templates.chloe
locals
http.server
http.server.filters
furnace ;
IN: furnace.boilerplate
TUPLE: boilerplate < filter-responder template ;
TUPLE: boilerplate < filter-responder template init ;
: <boilerplate> ( responder -- boilerplate ) f boilerplate boa ;
: <boilerplate> ( responder -- boilerplate )
boilerplate new
swap >>responder
[ ] >>init ;
M:: boilerplate call-responder* ( path responder -- )
begin-form
path responder call-next-method
responder init>> call
dup content-type>> "text/html" = [
clone [| body |
[

View File

@ -28,6 +28,23 @@
<h1><t:write-title /></h1>
<t:call-next-template />
<table width="100%">
<tr>
<td> <t:call-next-template /> </td>
<t:if t:value="sidebar">
<td valign="top">
<t:bind t:name="sidebar">
<h2>
<t:a t:href="$wiki/view" t:query="title">
<t:label t:name="title" />
</t:a>
</h2>
<t:farkup t:name="content" />
</t:bind>
</td>
</t:if>
</tr>
</table>
</t:chloe>

View File

@ -78,6 +78,10 @@ M: revision feed-entry-url id>> revision-url ;
<action>
[ "Front Page" view-url <redirect> ] >>display ;
: latest-revision ( title -- revision/f )
<article> select-tuple
dup [ revision>> <revision> select-tuple ] when ;
: <view-article-action> ( -- action )
<action>
@ -88,8 +92,8 @@ M: revision feed-entry-url id>> revision-url ;
] >>init
[
"title" value dup <article> select-tuple [
revision>> <revision> select-tuple from-object
"title" value dup latest-revision [
from-object
{ wiki "view" } <chloe-content>
] [
edit-url <redirect>
@ -297,4 +301,5 @@ M: revision feed-entry-url id>> revision-url ;
<list-changes-feed-action> "changes.atom" add-responder
<delete-action> "delete" add-responder
<boilerplate>
[ "sidebar" [ "Sidebar" latest-revision from-object ] nest-form ] >>init
{ wiki "wiki-common" } >>template ;