summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mulkcms.asd2
-rw-r--r--mulkcms.lisp6
-rw-r--r--package.lisp2
-rw-r--r--templates/article.html35
4 files changed, 43 insertions, 2 deletions
diff --git a/mulkcms.asd b/mulkcms.asd
index f340bf1..b4544d8 100644
--- a/mulkcms.asd
+++ b/mulkcms.asd
@@ -6,7 +6,7 @@
:serial t
:version "0.0.1"
:depends-on (:cl-who :cl-json :alexandria :postmodern :split-sequence
- :cl-ppcre :cl-fad :cxml :closure-html)
+ :cl-ppcre :cl-fad :cxml :closure-html :json-template)
:components ((:file "site")
(:file "package")
(:file "mulkcms")))
diff --git a/mulkcms.lisp b/mulkcms.lisp
index 7f427b1..444cafa 100644
--- a/mulkcms.lisp
+++ b/mulkcms.lisp
@@ -3,3 +3,9 @@
(defparameter *database-connection-spec*
(list *database-name* *database-user* *database-password* *database-host*))
+(unless (member "html" *template-filters* :key #'car :test #'equal)
+ (push `("html" . ,(lambda (x) (cl-who:escape-string (string x))))
+ *template-filters*)
+ (push `("html-attr-value" . ,(lambda (x) (cl-who:escape-string (string x))))
+ *template-filters*))
+
diff --git a/package.lisp b/package.lisp
index c034013..6b0c7cb 100644
--- a/package.lisp
+++ b/package.lisp
@@ -1,6 +1,6 @@
(cl:defpackage #:mulkcms
(:use #:common-lisp #:split-sequence #:alexandria #:cl-fad #:cl-who
- #:cl-ppcre #:postmodern)
+ #:cl-ppcre #:postmodern #:json-template)
(:shadow #:copy-file #:copy-stream)
(:export #:*base-uri*
#:*static-files*
diff --git a/templates/article.html b/templates/article.html
new file mode 100644
index 0000000..d3d46c3
--- /dev/null
+++ b/templates/article.html
@@ -0,0 +1,35 @@
+<article>
+ <h1><a href="{link|html-attr-value}">{title|html}</a></h1>
+
+ <div class="article-header">
+ <header>
+ <span class="article-date">
+ <time pubdate="pubdate" datetime="{publishing_date|html_iso_date}">
+ {publishing_date|html_human_date}
+ </time>
+ </span>
+ </header>
+ </div>
+
+ <div class="article-body">
+ {body}
+ </div>
+
+ <div class="article-footer">
+ <footer>
+ <form class="article-edit-button-form"
+ style="display: inline;"
+ action="{edit-link|html-attr-value}"
+ method="get">
+ <div style="display: inline;">
+ <input name="id" type="hidden" value="106" />
+ <input type="submit" value="{edit-button-label|html-attr-value}" />
+ </div>
+ </form>
+ |
+ <a href="{comment-feed|html-attr-value}">{comment-feed-label|html}</a>
+ |
+ <a href="{comment-feed|html-attr-value}">{comments-label|html}</a>
+ </footer>
+ </div>
+</article>