Mass rename indices->indexes.
This commit is contained in:
parent
b11b6fbf94
commit
c75e62e724
3 changed files with 14 additions and 14 deletions
|
@ -39,7 +39,7 @@ generator. Content Types were added in 0.8 as a step towards making
|
||||||
limitations. Chiefly, the association between Content Types, their
|
limitations. Chiefly, the association between Content Types, their
|
||||||
template, and their inclusion in an INDEX is presently ad-hoc.
|
template, and their inclusion in an INDEX is presently ad-hoc.
|
||||||
|
|
||||||
### Current Content Types & Indices
|
### Current Content Types & Indexes
|
||||||
|
|
||||||
There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
|
There are 3 INDEX subclasses at present: TAG-INDEX, DATE-INDEX, and
|
||||||
NUMERIC-INDEX, for grouping content by tags, publishing date, and
|
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
|
||||||
appropriate fashion, rendering them, and passing the result to
|
appropriate fashion, rendering them, and passing the result to
|
||||||
`write-page` (which should probably just be renamed to `write-file`).
|
`write-page` (which should probably just be renamed to `write-file`).
|
||||||
|
|
||||||
After this, `render-indices` and `render-feeds` are called, and an
|
After this, `render-indexes` and `render-feeds` are called, and an
|
||||||
'index.html' symlink is created to point to the first reverse
|
'index.html' symlink is created to point to the first reverse
|
||||||
chronological index.
|
chronological index.
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ Unfortunately, this does not solve:
|
||||||
was installed in the theme package. The plugin would need to do
|
was installed in the theme package. The plugin would need to do
|
||||||
this itself or the template would need to be included in 'core'.
|
this itself or the template would need to be included in 'core'.
|
||||||
2. More seriously, there is no formal relationship between content
|
2. More seriously, there is no formal relationship between content
|
||||||
types and indices. Indices include *ALL* objects in the `*content*`
|
types and indexes. Indices include *ALL* objects in the `*content*`
|
||||||
hash table. This may be undesirable and doesn't permit indices
|
hash table. This may be undesirable and doesn't permit indexes
|
||||||
dedicated to particular content types.
|
dedicated to particular content types.
|
||||||
|
|
||||||
### New Content Type: Shouts!
|
### New Content Type: Shouts!
|
||||||
|
@ -142,7 +142,7 @@ by banging on the config or specify the path in its `enable` options.
|
||||||
### Incremental Compilation
|
### Incremental Compilation
|
||||||
|
|
||||||
Incremental compilation is doable, even straightforward if you ignore
|
Incremental compilation is doable, even straightforward if you ignore
|
||||||
indices. It is also preferable to building the site in parallel as
|
indexes. It is also preferable to building the site in parallel as
|
||||||
avoiding work is better than using more workers. Moreover, being
|
avoiding work is better than using more workers. Moreover, being
|
||||||
able to determine (and expose) what files just changed enables new
|
able to determine (and expose) what files just changed enables new
|
||||||
functionality such as plugins that cross-post to tumblr.
|
functionality such as plugins that cross-post to tumblr.
|
||||||
|
@ -158,6 +158,6 @@ things the existing deployment model would not work as it involves
|
||||||
rebuilding the entire site. In all likelihood we would want to update
|
rebuilding the entire site. In all likelihood we would want to update
|
||||||
the site 'in-place'. Atomicity of filesystem operations would be a
|
the site 'in-place'. Atomicity of filesystem operations would be a
|
||||||
reasonable concern. Also, every numbered INDEX would have to be
|
reasonable concern. Also, every numbered INDEX would have to be
|
||||||
regenerated along with any tag or month indices matching the
|
regenerated along with any tag or month indexes matching the
|
||||||
modified files. If incremental compilation is a goal, simply
|
modified files. If incremental compilation is a goal, simply
|
||||||
disabling the indices may be appropriate for certain users.
|
disabling the indexes may be appropriate for certain users.
|
||||||
|
|
|
@ -59,7 +59,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
|
||||||
(when (probe-file dir)
|
(when (probe-file dir)
|
||||||
(run-program "rsync --delete -raz ~a ." dir)))
|
(run-program "rsync --delete -raz ~a ." dir)))
|
||||||
(do-ctypes (publish (make-keyword ctype)))
|
(do-ctypes (publish (make-keyword ctype)))
|
||||||
(render-indices)
|
(render-indexes)
|
||||||
(update-symlink "index.html" "1.html")
|
(update-symlink "index.html" "1.html")
|
||||||
(render-feeds (feeds *config*))))
|
(render-feeds (feeds *config*))))
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(in-package :coleslaw)
|
(in-package :coleslaw)
|
||||||
|
|
||||||
(defclass index ()
|
(defclass index ()
|
||||||
((id :initform nil :initarg :id :accessor index-id)
|
((slug :initform nil :initarg :slug :accessor index-slug)
|
||||||
(posts :initform nil :initarg :posts :accessor index-posts)
|
(posts :initform nil :initarg :posts :accessor index-posts)
|
||||||
(title :initform nil :initarg :title :accessor index-title)))
|
(title :initform nil :initarg :title :accessor index-title)))
|
||||||
|
|
||||||
|
@ -40,13 +40,13 @@
|
||||||
|
|
||||||
(defun index-by-tag (tag content)
|
(defun index-by-tag (tag content)
|
||||||
"Return an index of all CONTENT matching the given TAG."
|
"Return an index of all CONTENT matching the given TAG."
|
||||||
(make-instance 'tag-index :id (tag-slug tag)
|
(make-instance 'tag-index :slug (tag-slug tag)
|
||||||
:posts (remove-if-not (lambda (x) (tag-p tag x)) content)
|
:posts (remove-if-not (lambda (x) (tag-p tag x)) content)
|
||||||
:title (format nil "Posts tagged ~a" (tag-name tag))))
|
:title (format nil "Posts tagged ~a" (tag-name tag))))
|
||||||
|
|
||||||
(defun index-by-month (month content)
|
(defun index-by-month (month content)
|
||||||
"Return an index of all CONTENT matching the given MONTH."
|
"Return an index of all CONTENT matching the given MONTH."
|
||||||
(make-instance 'date-index :id month
|
(make-instance 'date-index :slug month
|
||||||
:posts (remove-if-not (lambda (x) (month-p month x)) content)
|
:posts (remove-if-not (lambda (x) (month-p month x)) content)
|
||||||
:title (format nil "Posts from ~a" month)))
|
:title (format nil "Posts from ~a" month)))
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
"Return the index for the Ith page of CONTENT in reverse chronological order."
|
"Return the index for the Ith page of CONTENT in reverse chronological order."
|
||||||
(let* ((start (* step i))
|
(let* ((start (* step i))
|
||||||
(end (min (length content) (+ start step))))
|
(end (min (length content) (+ start step))))
|
||||||
(make-instance 'numeric-index :id (1+ i)
|
(make-instance 'numeric-index :slug (1+ i)
|
||||||
:posts (subseq content start end)
|
:posts (subseq content start end)
|
||||||
:title "Recent Posts")))
|
:title "Recent Posts")))
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@
|
||||||
"Render the given INDEX using RENDER-ARGS if provided."
|
"Render the given INDEX using RENDER-ARGS if provided."
|
||||||
(write-page (page-path index) (apply #'render-page index nil render-args)))
|
(write-page (page-path index) (apply #'render-page index nil render-args)))
|
||||||
|
|
||||||
(defun render-indices ()
|
(defun render-indexes ()
|
||||||
"Render the indices to view content in groups of size N, by month, and by tag."
|
"Render the indexes to view content in groups of size N, by month, and by tag."
|
||||||
(let ((results (by-date (find-all 'post))))
|
(let ((results (by-date (find-all 'post))))
|
||||||
(dolist (tag (all-tags))
|
(dolist (tag (all-tags))
|
||||||
(render-index (index-by-tag tag results)))
|
(render-index (index-by-tag tag results)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue