I just pushed Fabulator 0.0.12 and Radiant Fabulator Extension 0.0.9 to RubyGems. The first adds the template element to libraries. The latter adds a page and page-part action for creating pages in Radiant. This will eventually enable editing of existing pages, but for now it’s aimed at creating new ones. That’s the functionality we need, so that’s what we wrote.
You can use the page creation code by doing something like:
1
2
3
4
5
6
7
8
9
10
11
|
<rx:page rx:child-of="'/tmp'" rx:slug="$slug" rx:title="$title" rx:status="'published'">
<rx:page-part
rx:name="'body'"
f:select="t:blog-body($title, $slug, $content)"
rx:filter="'Markdown'" />
<rx:page-part
rx:name="'summary'"
f:select="t:blog-summary($title, $slug, $summary)"
rx:filter="'Markdown'" />
</rx:page>
|
The t:blog-body
and t:blog-summary
functions are templates defined in a library:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<l:library xmlns:l="http://dh.tamu.edu/ns/fabulator/library/1.0#"
l:ns="..."
>
<l:template l:name="blog-body">
<!--
$1: title
$2: slug
$3: content
-->
## <f:value-of f:select="$1" />
<f:value-of f:select="$3" />
</l:template>
<l:template l:name="blog-summary">
<!--
$1: title
$2: slug
$3: content
-->
<f:value-of f:select="$3" />
</l:template>
</l:library>
|
Of course, this could be used to write programs that write programs. :-) We don’t have a way yet to execute programs from within other programs.