Explorar o código

Mass rename indices->indexes.

Brit Butler %!s(int64=11) %!d(string=hai) anos
pai
achega
c75e62e724
Modificáronse 3 ficheiros con 14 adicións e 14 borrados
  1. 7 7
      docs/hacking.md
  2. 1 1
      src/coleslaw.lisp
  3. 6 6
      src/indices.lisp

+ 7 - 7
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
42
+### Current Content Types & Indexes
43
 
43
 
44
 There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
44
 There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
45
 NUMERIC-INDEX, for grouping content by tags, publishing date, and
45
 NUMERIC-INDEX, for grouping content by tags, publishing date, and
89
 appropriate fashion, rendering them, and passing the result to
89
 appropriate fashion, rendering them, and passing the result to
90
 `write-page` (which should probably just be renamed to `write-file`).
90
 `write-page` (which should probably just be renamed to `write-file`).
91
 
91
 
92
-After this, `render-indices` and `render-feeds` are called, and an
92
+After this, `render-indexes` and `render-feeds` are called, and an
93
 'index.html' symlink is created to point to the first reverse
93
 'index.html' symlink is created to point to the first reverse
94
 chronological index.
94
 chronological index.
95
 
95
 
116
    was installed in the theme package. The plugin would need to do
116
    was installed in the theme package. The plugin would need to do
117
    this itself or the template would need to be included in 'core'.
117
    this itself or the template would need to be included in 'core'.
118
 2. More seriously, there is no formal relationship between content
118
 2. More seriously, there is no formal relationship between content
119
-   types and indices. Indices include *ALL* objects in the `*content*`
120
-   hash table. This may be undesirable and doesn't permit indices
119
+   types and indexes. Indices include *ALL* objects in the `*content*`
120
+   hash table. This may be undesirable and doesn't permit indexes
121
    dedicated to particular content types.
121
    dedicated to particular content types.
122
 
122
 
123
 ### New Content Type: Shouts!
123
 ### New Content Type: Shouts!
142
 ### Incremental Compilation
142
 ### Incremental Compilation
143
 
143
 
144
 Incremental compilation is doable, even straightforward if you ignore
144
 Incremental compilation is doable, even straightforward if you ignore
145
-indices. It is also preferable to building the site in parallel as
145
+indexes. It is also preferable to building the site in parallel as
146
 avoiding work is better than using more workers. Moreover, being
146
 avoiding work is better than using more workers. Moreover, being
147
 able to determine (and expose) what files just changed enables new
147
 able to determine (and expose) what files just changed enables new
148
 functionality such as plugins that cross-post to tumblr.
148
 functionality such as plugins that cross-post to tumblr.
158
 rebuilding the entire site. In all likelihood we would want to update
158
 rebuilding the entire site. In all likelihood we would want to update
159
 the site 'in-place'. Atomicity of filesystem operations would be a
159
 the site 'in-place'. Atomicity of filesystem operations would be a
160
 reasonable concern. Also, every numbered INDEX would have to be
160
 reasonable concern. Also, every numbered INDEX would have to be
161
-regenerated along with any tag or month indices matching the
161
+regenerated along with any tag or month indexes matching the
162
 modified files. If incremental compilation is a goal, simply
162
 modified files. If incremental compilation is a goal, simply
163
-disabling the indices may be appropriate for certain users.
163
+disabling the indexes may be appropriate for certain users.

+ 1 - 1
src/coleslaw.lisp

59
       (when (probe-file dir)
59
       (when (probe-file dir)
60
         (run-program "rsync --delete -raz ~a ." dir)))
60
         (run-program "rsync --delete -raz ~a ." dir)))
61
     (do-ctypes (publish (make-keyword ctype)))
61
     (do-ctypes (publish (make-keyword ctype)))
62
-    (render-indices)
62
+    (render-indexes)
63
     (update-symlink "index.html" "1.html")
63
     (update-symlink "index.html" "1.html")
64
     (render-feeds (feeds *config*))))
64
     (render-feeds (feeds *config*))))
65
 
65
 

+ 6 - 6
src/indices.lisp

1
 (in-package :coleslaw)
1
 (in-package :coleslaw)
2
 
2
 
3
 (defclass index ()
3
 (defclass index ()
4
-  ((id :initform nil :initarg :id :accessor index-id)
4
+  ((slug :initform nil :initarg :slug :accessor index-slug)
5
    (posts :initform nil :initarg :posts :accessor index-posts)
5
    (posts :initform nil :initarg :posts :accessor index-posts)
6
    (title :initform nil :initarg :title :accessor index-title)))
6
    (title :initform nil :initarg :title :accessor index-title)))
7
 
7
 
40
 
40
 
41
 (defun index-by-tag (tag content)
41
 (defun index-by-tag (tag content)
42
   "Return an index of all CONTENT matching the given TAG."
42
   "Return an index of all CONTENT matching the given TAG."
43
-  (make-instance 'tag-index :id (tag-slug tag)
43
+  (make-instance 'tag-index :slug (tag-slug tag)
44
                  :posts (remove-if-not (lambda (x) (tag-p tag x)) content)
44
                  :posts (remove-if-not (lambda (x) (tag-p tag x)) content)
45
                  :title (format nil "Posts tagged ~a" (tag-name tag))))
45
                  :title (format nil "Posts tagged ~a" (tag-name tag))))
46
 
46
 
47
 (defun index-by-month (month content)
47
 (defun index-by-month (month content)
48
   "Return an index of all CONTENT matching the given MONTH."
48
   "Return an index of all CONTENT matching the given MONTH."
49
-  (make-instance 'date-index :id month
49
+  (make-instance 'date-index :slug month
50
                  :posts (remove-if-not (lambda (x) (month-p month x)) content)
50
                  :posts (remove-if-not (lambda (x) (month-p month x)) content)
51
                  :title (format nil "Posts from ~a" month)))
51
                  :title (format nil "Posts from ~a" month)))
52
 
52
 
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 'numeric-index :id (1+ i)
57
+    (make-instance 'numeric-index :slug (1+ i)
58
                               :posts (subseq content start end)
58
                               :posts (subseq content start end)
59
                               :title "Recent Posts")))
59
                               :title "Recent Posts")))
60
 
60
 
62
   "Render the given INDEX using RENDER-ARGS if provided."
62
   "Render the given INDEX using RENDER-ARGS if provided."
63
   (write-page (page-path index) (apply #'render-page index nil render-args)))
63
   (write-page (page-path index) (apply #'render-page index nil render-args)))
64
 
64
 
65
-(defun render-indices ()
66
-  "Render the indices to view content in groups of size N, by month, and by tag."
65
+(defun render-indexes ()
66
+  "Render the indexes to view content in groups of size N, by month, and by tag."
67
   (let ((results (by-date (find-all 'post))))
67
   (let ((results (by-date (find-all 'post))))
68
     (dolist (tag (all-tags))
68
     (dolist (tag (all-tags))
69
       (render-index (index-by-tag tag results)))
69
       (render-index (index-by-tag tag results)))