浏览代码

Initial theme/template "hyde" adapted from ckeen and small API updates.

Brit Butler 14 年之前
父节点
当前提交
59661d3dc2
共有 8 个文件被更改,包括 149 次插入19 次删除
  1. 2 3
      coleslaw.asd
  2. 10 10
      src/comments.lisp
  3. 17 0
      src/packages.lisp
  4. 6 6
      src/posts.lisp
  5. 29 0
      themes/hyde/base.tmpl
  6. 31 0
      themes/hyde/css/style.css
  7. 31 0
      themes/hyde/index.tmpl
  8. 23 0
      themes/hyde/post.tmpl

+ 2 - 3
coleslaw.asd

@@ -1,12 +1,11 @@
1 1
 (defsystem :coleslaw
2 2
   :name "coleslaw-core"
3 3
   :description "Flexible Lisp Blogware"
4
-  :version "0.0.1"
4
+  :version "0.0.2"
5 5
   :maintainer "Brit Butler <redline6561@gmail.com>"
6 6
   :author "Brit Butler <redline6561@gmail.com>"
7 7
   :licence "LLGPL"
8
-  :depends-on (:cl-markdown :docutils
9
-               :closure-template :cl-fad)
8
+  :depends-on (:cl-markdown :docutils :closure-template :cl-fad)
10 9
   :components ((:module src
11 10
                         :components ((:file "packages")
12 11
                                      (:file "coleslaw"

+ 10 - 10
src/comments.lisp

@@ -1,29 +1,29 @@
1 1
 (in-package :coleslaw)
2 2
 
3 3
 (defclass author ()
4
-  ((name :initform nil
4
+  ((name :initform nil :initarg :name
5 5
          :accessor author-name)
6
-   (url :initform nil
6
+   (url :initform nil :initarg :url
7 7
         :accessor author-url)
8
-   (ip :initform nil
8
+   (ip :initform nil :initarg :ip
9 9
        :accessor author-ip)))
10 10
 
11 11
 (defclass comment ()
12
-  ((id :initform nil
12
+  ((id :initform nil :initarg :id
13 13
        :accessor comment-id)
14
-   (post :initform nil
14
+   (post :initform nil :initarg :post
15 15
          :accessor comment-post)
16
-   (author :initform nil
16
+   (author :initform nil :initarg :author
17 17
            :accessor comment-author)
18
-   (timestamp :initform nil
18
+   (timestamp :initform nil :initarg :timestamp
19 19
               :accessor comment-timestamp)
20
-   (content :initform nil
20
+   (content :initform nil :initarg :content
21 21
             :accessor comment-content)
22
-   (parent :initform nil
22
+   (parent :initform nil :initarg :parent
23 23
            :accessor comment-parent)))
24 24
 
25 25
 (defgeneric make-comment (post author timestamp content
26
-                          parent &key &allow-other-key)
26
+                          parent &key id &allow-other-keys)
27 27
   (:documentation "Create a COMMENT with the given data."))
28 28
 
29 29
 (defgeneric add-comment (comment post-id)

+ 17 - 0
src/packages.lisp

@@ -22,6 +22,12 @@
22 22
            #:find-by-date
23 23
            #:find-by-range
24 24
 
25
+           #:post-id
26
+           #:post-title
27
+           #:post-tags
28
+           #:post-date
29
+           #:post-content
30
+
25 31
            ;; comments
26 32
            #:make-comment
27 33
            #:add-comment
@@ -29,6 +35,17 @@
29 35
            #:render-comments
30 36
            #:find-comments
31 37
 
38
+           #:author-name
39
+           #:author-url
40
+           #:author-ip
41
+
42
+           #:comment-id
43
+           #:comment-post
44
+           #:comment-author
45
+           #:comment-timestamp
46
+           #:comment-content
47
+           #:comment-parent
48
+
32 49
            ;; indices
33 50
            #:add-index
34 51
            #:remove-index

+ 6 - 6
src/posts.lisp

@@ -1,18 +1,18 @@
1 1
 (in-package :coleslaw)
2 2
 
3 3
 (defclass post ()
4
-  ((id :initform nil
4
+  ((id :initform nil :initarg :id
5 5
        :accessor post-id)
6
-   (title :initform nil
6
+   (title :initform nil :initarg :title
7 7
           :accessor post-title)
8
-   (tags :initform nil
8
+   (tags :initform nil :initarg :tags
9 9
          :accessor post-tags)
10
-   (date :initform nil
10
+   (date :initform nil :initarg :date
11 11
          :accessor post-date)
12
-   (content :initform nil
12
+   (content :initform nil :initarg :content
13 13
             :accessor post-content)))
14 14
 
15
-(defgeneric make-post (title tags date content &key &allow-other-keys)
15
+(defgeneric make-post (title tags date content &key id &allow-other-keys)
16 16
   (:documentation "Create a POST with the given data."))
17 17
 
18 18
 (defgeneric add-post (post id)

+ 29 - 0
themes/hyde/base.tmpl

@@ -0,0 +1,29 @@
1
+{namespace coleslaw.theme.hyde}
2
+
3
+{template base}
4
+<!doctype html>{\n}
5
+<html>
6
+  <head>
7
+    <title>{$title}</title>
8
+    <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
9
+    <link href="http://fonts.googleapis.com/css?family=Vollkorn:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css" />
10
+    <link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css" />
11
+    <link href= "{$siteroot}/css/style.css" rel="stylesheet" type="text/css" />
12
+    <link rel="alternate" href="{$siteroot}/feed.atom" type="application/atom+xml" />
13
+    {if $headInject} {$headInject |noAutoescape} {/if}
14
+  </head>
15
+  <body>
16
+    <div class="navigation">
17
+      {$navigation |noAutoescape}
18
+      {$title}
19
+    </div>
20
+    <div id="content">
21
+      {$content |noAutoescape}
22
+    </div>
23
+    {if $bodyInject} {$bodyInject |noAutoescape} {/if}
24
+    <div class="fineprint">
25
+      Unless otherwise credited all material {if $license} {$license} {else} © {/if} {$credits}
26
+    </div>
27
+  </body>
28
+</html>
29
+{/template}

+ 31 - 0
themes/hyde/css/style.css

@@ -0,0 +1,31 @@
1
+#content { background: #fff; padding-top: 1em }
2
+#header { float: right; margin-left: 1em; margin-bottom: 1em }
3
+a { text-decoration: none; color: #992900 }
4
+a.anchor { color: black }
5
+.date { font-style: italic }
6
+.title { margin-left: 1em }
7
+.article-meta { margin-left: 2.2em; margin-bottom: 2.2em }
8
+.archive-title { font-size: 1em } .article-title { font-size: 2em }
9
+.article-content { margin-left: 2.2em }
10
+.fineprint { text-align: center; font-size: .9em; margin-top: .5em }
11
+.tag-low { font-size: .8em; font-weight: 200 }
12
+.tag-medium { font-size: 1.2em; font-weight: 600 }
13
+.tag-high { font-size: 1.8em; font-weight: 800 }
14
+.navigation { font-size: 1.2em; border-bottom: 1px solid }
15
+body { background-color: white; font-family: Vollkorn; font-size: 14pt }
16
+.highlight { background-color: (unquote light-yellow) }
17
+.highlight .symbol, .highlight .default, .highlight .comment { background-color: white; font-weight: normal; color: black }
18
+.highlight i { font-style: normal }
19
+.highlight i .symbol { font-weight: bold; color: (unquote red1) }
20
+.highlight .paren1, .highlight .paren2, .highlight .paren3, .highlight .paren4, .highlight .paren5, .highlight .paren6 { background-color: inherit }
21
+.highlight .paren1:hover, .highlight .paren2:hover, .highlight .paren3:hover, .highlight .paren4:hover, .highlight .paren5:hover, .highlight .paren6:hover { font-weight: bold; color: white }
22
+.highlight .string { font-style: italic; font-weight: light; color: #992900 }
23
+.highlight .paren1:hover { background-color: #DB7859 }
24
+.highlight .paren2:hover { background-color: #1B804C }
25
+.highlight .paren3:hover { background-color: #9F214E }
26
+.highlight .paren4:hover { background-color: #DBA059 }
27
+.highlight .paren5:hover { background-color: #B64926 }
28
+.highlight .paren6:hover { background-color: #64A422 }
29
+.highlight .comment { color: (unquote red2) }
30
+pre { overflow: auto; margin-left: 1em; padding: 0.5em; border-left: 1px dashed; background-color: white; padding: .75em .5em; font-family: (unquote mono-font) }
31
+tt { font-size: .9em; font-family: (unquote mono-font) }

+ 31 - 0
themes/hyde/index.tmpl

@@ -0,0 +1,31 @@
1
+{namespace coleslaw.theme.hyde}
2
+
3
+{template index}
4
+{if $taglinks}
5
+<div id="tagsoup">
6
+  <p>This blog covers: {$taglinks |noAutoescape}
7
+</div>
8
+{/if}
9
+{if $monthlinks}
10
+<div id="monthsoup">
11
+  <p>View blogs from: {$monthlinks |noAutoescape}
12
+</div>
13
+{/if}
14
+<h1>{$title}</h1>
15
+{foreach $post in $posts}
16
+  <div class="article-meta">
17
+    <a class="article-title" href="{$post.url}">{$post.title}</a>
18
+    <div class="date"> posted on {$post.date}</div>
19
+    <div class="article">{$post.contents |noAutoescape}</div>
20
+    {if $count}
21
+      <div class="comment-count">
22
+        <a href="{$post.url}">{$post.comments} comments</a>
23
+      </div>
24
+    {/if}
25
+  </div>
26
+{/foreach}
27
+<div id="relative-nav">
28
+  {if $prev} <a href="{$prev}">Previous</a> {/if}
29
+  {if $next} <a href="{$next}">Next</a> {/if}
30
+</div>
31
+{/template}

+ 23 - 0
themes/hyde/post.tmpl

@@ -0,0 +1,23 @@
1
+{namespace coleslaw.theme.hyde}
2
+
3
+{template post}
4
+<div class="article-meta">
5
+  <h1 class="title" {$title}>
6
+  <div class="tags"
7
+    Tagged as: {$tags}
8
+  </div>
9
+  <div class="date">
10
+    Written on {$date}
11
+  </div>
12
+  <div class="article-content">
13
+    {$content |noAutoescape}
14
+  </div>
15
+  <div class="relative-nav">
16
+    {if $prev} <a href="{$prev}">Previous</a> {/if}
17
+    {if $next} <a href="{$next}">Next</a> {/if}
18
+  </div>
19
+  {if $comments}
20
+  <div class="comments">{$comments |noAutoescape}</div>
21
+  {/if}
22
+</div>
23
+{/template}