Quellcode durchsuchen

Mass rename indices->indexes.

Brit Butler vor 11 Jahren
Ursprung
Commit
c75e62e724
3 geänderte Dateien mit 14 neuen und 14 gelöschten Zeilen
  1. 7 7
      docs/hacking.md
  2. 1 1
      src/coleslaw.lisp
  3. 6 6
      src/indices.lisp

+ 7 - 7
docs/hacking.md

@@ -39,7 +39,7 @@ generator.  Content Types were added in 0.8 as a step towards making
39 39
 limitations. Chiefly, the association between Content Types, their
40 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 44
 There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
45 45
 NUMERIC-INDEX, for grouping content by tags, publishing date, and
@@ -89,7 +89,7 @@ the objects of that content type by iterating over the objects in an
89 89
 appropriate fashion, rendering them, and passing the result to
90 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 93
 'index.html' symlink is created to point to the first reverse
94 94
 chronological index.
95 95
 
@@ -116,8 +116,8 @@ Unfortunately, this does not solve:
116 116
    was installed in the theme package. The plugin would need to do
117 117
    this itself or the template would need to be included in 'core'.
118 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 121
    dedicated to particular content types.
122 122
 
123 123
 ### New Content Type: Shouts!
@@ -142,7 +142,7 @@ by banging on the config or specify the path in its `enable` options.
142 142
 ### Incremental Compilation
143 143
 
144 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 146
 avoiding work is better than using more workers. Moreover, being
147 147
 able to determine (and expose) what files just changed enables new
148 148
 functionality such as plugins that cross-post to tumblr.
@@ -158,6 +158,6 @@ things the existing deployment model would not work as it involves
158 158
 rebuilding the entire site. In all likelihood we would want to update
159 159
 the site 'in-place'. Atomicity of filesystem operations would be a
160 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 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,7 +59,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
59 59
       (when (probe-file dir)
60 60
         (run-program "rsync --delete -raz ~a ." dir)))
61 61
     (do-ctypes (publish (make-keyword ctype)))
62
-    (render-indices)
62
+    (render-indexes)
63 63
     (update-symlink "index.html" "1.html")
64 64
     (render-feeds (feeds *config*))))
65 65
 

+ 6 - 6
src/indices.lisp

@@ -1,7 +1,7 @@
1 1
 (in-package :coleslaw)
2 2
 
3 3
 (defclass index ()
4
-  ((id :initform nil :initarg :id :accessor index-id)
4
+  ((slug :initform nil :initarg :slug :accessor index-slug)
5 5
    (posts :initform nil :initarg :posts :accessor index-posts)
6 6
    (title :initform nil :initarg :title :accessor index-title)))
7 7
 
@@ -40,13 +40,13 @@
40 40
 
41 41
 (defun index-by-tag (tag content)
42 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 44
                  :posts (remove-if-not (lambda (x) (tag-p tag x)) content)
45 45
                  :title (format nil "Posts tagged ~a" (tag-name tag))))
46 46
 
47 47
 (defun index-by-month (month content)
48 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 50
                  :posts (remove-if-not (lambda (x) (month-p month x)) content)
51 51
                  :title (format nil "Posts from ~a" month)))
52 52
 
@@ -54,7 +54,7 @@
54 54
   "Return the index for the Ith page of CONTENT in reverse chronological order."
55 55
   (let* ((start (* step i))
56 56
          (end (min (length content) (+ start step))))
57
-    (make-instance 'numeric-index :id (1+ i)
57
+    (make-instance 'numeric-index :slug (1+ i)
58 58
                               :posts (subseq content start end)
59 59
                               :title "Recent Posts")))
60 60
 
@@ -62,8 +62,8 @@
62 62
   "Render the given INDEX using RENDER-ARGS if provided."
63 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 67
   (let ((results (by-date (find-all 'post))))
68 68
     (dolist (tag (all-tags))
69 69
       (render-index (index-by-tag tag results)))