Selaa lähdekoodia

Add some content type details to hacking.md. Minor renaming.

Brit Butler 11 vuotta sitten
vanhempi
commit
3ccc0fb5d0
2 muutettua tiedostoa jossa 25 lisäystä ja 3 poistoa
  1. 22 0
      docs/hacking.md
  2. 3 3
      src/indices.lisp

+ 22 - 0
docs/hacking.md

39
 limitations. Chiefly, the association between Content Types, their
39
 limitations. Chiefly, the association between Content Types, their
40
 template, and their inclusion in an INDEX is presently ad-hoc.
40
 template, and their inclusion in an INDEX is presently ad-hoc.
41
 
41
 
42
+### Current Content Types & Indices
43
+
44
+There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
45
+NUMERIC-INDEX, for grouping content by tags, publishing date, and
46
+reverse chronological order, respectively. Currently, there is only 1
47
+content type: POST, for blog entries.
48
+
49
+I'm planning to add a content type PAGE, for static pages. It should
50
+be a pretty straightforward subclass of CONTENT with the necessary
51
+methods: `render`, `page-url` and `publish`, but will require a small
52
+tweak to prevent showing up in any INDEX.
53
+
42
 ### Templates and Theming
54
 ### Templates and Theming
43
 
55
 
44
 User configs are allowed to specify a theme, otherwise the default is
56
 User configs are allowed to specify a theme, otherwise the default is
108
    hash table. This may be undesirable and doesn't permit indices
120
    hash table. This may be undesirable and doesn't permit indices
109
    dedicated to particular content types.
121
    dedicated to particular content types.
110
 
122
 
123
+### New Content Type: Shouts!
124
+
125
+I've also toyed with the idea of a content type called a SHOUT, which
126
+would be used primarily to reference or embed other content, sort of a
127
+mix between a retweet and a del.icio.us bookmark. We encounter plenty
128
+of great things on the web. Most of mine winds up forgotten in browser
129
+tabs or stored on twitter's servers. It would be cool to see SHOUTs as
130
+a plugin, probably with a dedicated SHOUT-INDEX, and some sort of
131
+oEmbed/embed.ly/noembed support.
132
+
111
 ### Layouts and Paths
133
 ### Layouts and Paths
112
 
134
 
113
 Defining a page-url for every content-object and index seems a bit
135
 Defining a page-url for every content-object and index seems a bit

+ 3 - 3
src/indices.lisp

7
 
7
 
8
 (defclass tag-index (index) ())
8
 (defclass tag-index (index) ())
9
 (defclass date-index (index) ())
9
 (defclass date-index (index) ())
10
-(defclass int-index (index) ())
10
+(defclass numeric-index (index) ())
11
 
11
 
12
 (defmethod page-url ((object index))
12
 (defmethod page-url ((object index))
13
   (index-id object))
13
   (index-id object))
15
   (format nil "tag/~a" (index-id object)))
15
   (format nil "tag/~a" (index-id object)))
16
 (defmethod page-url ((object date-index))
16
 (defmethod page-url ((object date-index))
17
   (format nil "date/~a" (index-id object)))
17
   (format nil "date/~a" (index-id object)))
18
-(defmethod page-url ((object int-index))
18
+(defmethod page-url ((object numeric-index))
19
   (format nil "~d" (index-id object)))
19
   (format nil "~d" (index-id object)))
20
 
20
 
21
 (defmethod render ((object index) &key prev next)
21
 (defmethod render ((object index) &key prev next)
54
   "Return the index for the Ith page of CONTENT in reverse chronological order."
54
   "Return the index for the Ith page of CONTENT in reverse chronological order."
55
   (let* ((start (* step i))
55
   (let* ((start (* step i))
56
          (end (min (length content) (+ start step))))
56
          (end (min (length content) (+ start step))))
57
-    (make-instance 'int-index :id (1+ i)
57
+    (make-instance 'numeric-index :id (1+ i)
58
                               :posts (subseq content start end)
58
                               :posts (subseq content start end)
59
                               :title "Recent Posts")))
59
                               :title "Recent Posts")))
60
 
60