diff options
author | Arun Isaac | 2019-08-26 00:07:28 +0530 |
---|---|---|
committer | Arun Isaac | 2019-08-26 00:07:28 +0530 |
commit | ddce6f1a1476ae7cce5c4c09065e34d9671162a0 (patch) | |
tree | 9dceeffa28eb85087f136e02a67742570aceefb5 /ennu.el | |
parent | db8f670ebcb42fdfd7156f9917f7dab59502e9bd (diff) | |
download | ennum-ddce6f1a1476ae7cce5c4c09065e34d9671162a0.tar.gz ennum-ddce6f1a1476ae7cce5c4c09065e34d9671162a0.tar.lz ennum-ddce6f1a1476ae7cce5c4c09065e34d9671162a0.zip |
Optionally, generate index filenames without extensions.
* ennu.el (ennu-index-filename): Make extension argument optional. If
extension is nil, do not add extension to generated filename.
(ennu-publish-index): Use links without extension for pagination.
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 |