diff options
Diffstat (limited to 'ennu.el')
-rw-r--r-- | ennu.el | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -75,17 +75,15 @@ last form in BODY." tongue (file-name-extension filename))))) -(defun ennu-index-filename (filename-prefix tongue extension &optional page-number) - (ennu-add-tongue-suffix - (if page-number - (format "%s-%s.%s" - (file-name-nondirectory filename-prefix) - page-number - extension) - (format "%s.%s" (filename-nondirectory filename-prefix) extension)) - tongue)) - (defun ennu-publish-index (filename-prefix tongue title subtitle posts-per-page posts) +(defun ennu-index-filename (filename-prefix tongue &optional extension page-number) + (let ((extension (if extension (concat "." extension) ""))) + (ennu-add-tongue-suffix + (if page-number + (format "%s-%s%s" (file-name-nondirectory filename-prefix) page-number extension) + (concat (file-name-nondirectory filename-prefix) extension)) + tongue))) + (let* ((number-of-pages (ceiling (length posts) posts-per-page)) (page-numbers (number-sequence 1 number-of-pages))) `(,posts @@ -121,10 +119,10 @@ last form in BODY." posts) (unless (= page-number 1) (insert (format "[[./%s][Newer posts]]\n" - (ennu-index-filename filename-prefix tongue "org" (1- page-number))))) + (ennu-index-filename filename-prefix tongue nil (1- page-number))))) (unless (= page-number number-of-pages) (insert (format "[[./%s][Older posts]]\n" - (ennu-index-filename filename-prefix tongue "org" (1+ page-number))))) + (ennu-index-filename filename-prefix tongue nil (1+ page-number))))) (org-export-to-file 'ennu-html output-file))) (seq-partition posts posts-per-page) page-numbers |