Text is the universal interface.

This commit is contained in:
Brit Butler 2013-01-01 20:16:28 -05:00
parent 04937e88bf
commit cc2700b817
6 changed files with 10 additions and 10 deletions

View file

@ -6,7 +6,8 @@
(defclass content () (defclass content ()
((tags :initform nil :initarg :tags :accessor content-tags) ((tags :initform nil :initarg :tags :accessor content-tags)
(slug :initform nil :initarg :slug :accessor content-slug) (slug :initform nil :initarg :slug :accessor content-slug)
(date :initform nil :initarg :date :accessor content-date))) (date :initform nil :initarg :date :accessor content-date)
(text :initform nil :initarg :text :accessor content-text)))
(defun construct (content-type args) (defun construct (content-type args)
"Create an instance of CONTENT-TYPE with the given ARGS." "Create an instance of CONTENT-TYPE with the given ARGS."
@ -42,7 +43,7 @@ If PLIST-P is non-nil, a single plist is returned with :content holding the text
(content (slurp-remainder in))) (content (slurp-remainder in)))
(setf (getf meta :tags) (read-delimited (getf meta :tags))) (setf (getf meta :tags) (read-delimited (getf meta :tags)))
(if plist-p (if plist-p
(append meta (list :content content)) (append meta (list :text content))
(values meta content)))))) (values meta content))))))
(defun find-all (content-type) (defun find-all (content-type)

View file

@ -2,8 +2,7 @@
(defclass post (content) (defclass post (content)
((title :initform nil :initarg :title :accessor post-title) ((title :initform nil :initarg :title :accessor post-title)
(format :initform nil :initarg :format :accessor post-format) (format :initform nil :initarg :format :accessor post-format)))
(content :initform nil :initarg :content :accessor post-content)))
(defmethod render ((object post) &key prev next) (defmethod render ((object post) &key prev next)
(funcall (theme-fn 'post) (list :config *config* (funcall (theme-fn 'post) (list :config *config*
@ -17,10 +16,10 @@
(defmethod initialize-instance :after ((object post) &key) (defmethod initialize-instance :after ((object post) &key)
(with-accessors ((title post-title) (with-accessors ((title post-title)
(format post-format) (format post-format)
(content post-content)) object (text content-text)) object
(setf (content-slug object) (slugify title) (setf (content-slug object) (slugify title)
format (make-keyword (string-upcase format)) format (make-keyword (string-upcase format))
content (render-content content format)))) text (render-content text format))))
(defmethod discover ((content-type (eql :post))) (defmethod discover ((content-type (eql :post)))
(purge-all 'post) (purge-all 'post)

View file

@ -22,7 +22,7 @@
<name>{$config.author}</name> <name>{$config.author}</name>
<uri>{$config.domain}</uri> <uri>{$config.domain}</uri>
</author> </author>
<content type="html">{$post.content |noAutoescape}</content> <content type="html">{$post.text |noAutoescape}</content>
</entry> </entry>
{/foreach} {/foreach}

View file

@ -6,7 +6,7 @@
<div class="article-meta"> <div class="article-meta">
<a class="article-title" href="{$config.domain}/posts/{$post.slug}.html">{$post.title}</a> <a class="article-title" href="{$config.domain}/posts/{$post.slug}.html">{$post.title}</a>
<div class="date"> posted on {$post.date}</div> <div class="date"> posted on {$post.date}</div>
<div class="article">{$post.content |noAutoescape}</div> <div class="article">{$post.text |noAutoescape}</div>
</div> </div>
{/foreach} {/foreach}
<div id="relative-nav"> <div id="relative-nav">

View file

@ -14,7 +14,7 @@
</div>{\n} </div>{\n}
</div>{\n} </div>{\n}
<div class="article-content">{\n} <div class="article-content">{\n}
{$post.content |noAutoescape} {$post.text |noAutoescape}
</div>{\n} </div>{\n}
<div class="relative-nav">{\n} <div class="relative-nav">{\n}
{if $prev} <a href="{$config.domain}/posts/{$prev.slug}.html">Previous</a><br> {/if}{\n} {if $prev} <a href="{$config.domain}/posts/{$prev.slug}.html">Previous</a><br> {/if}{\n}

View file

@ -20,7 +20,7 @@
{foreach $tag in $post.tags} {foreach $tag in $post.tags}
<category><![CDATA[ {$tag} ]]></category> <category><![CDATA[ {$tag} ]]></category>
{/foreach} {/foreach}
<description><![CDATA[ {$post.content |noAutoescape} ]]></description> <description><![CDATA[ {$post.text |noAutoescape} ]]></description>
</item> </item>
{/foreach} {/foreach}