diff options
author | Arun Isaac | 2022-08-18 23:33:03 +0530 |
---|---|---|
committer | Arun Isaac | 2022-08-18 23:33:03 +0530 |
commit | fd902d67a43be8ccd326f67a31461b54155ddfe8 (patch) | |
tree | 16d53ac78b8c6260c27f0ee6c94632acc97b68c3 | |
parent | 1b5a4c3feb0fde59bf3ded2d3d8c0832884b403d (diff) | |
download | ennum-fd902d67a43be8ccd326f67a31461b54155ddfe8.tar.gz ennum-fd902d67a43be8ccd326f67a31461b54155ddfe8.tar.lz ennum-fd902d67a43be8ccd326f67a31461b54155ddfe8.zip |
Introduce :required-metadata setting.
* ennum.el (ennum-mandatory-metadata): Delete variable.
(ennum-setting): Define the :required-metadata setting.
(ennum-blog): Document the :required-metadata property.
(ennum--read-post): Use the :required-metadata setting instead of
ennum-mandatory-metadata.
-rw-r--r-- | ennum.el | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -127,6 +127,12 @@ pixels. Association list mapping languages to locales. Defaults to ((\"en\" . \"C\")). +`:required-metadata' + +List of post metadata properties that are required. If any post +does not have the listed metadata properties, an error is +raised. Defaults to (:title :date). + `:store' Path to the ennum store. The store is a temporary directory used @@ -376,7 +382,7 @@ the current state of all its variables." (ennum-with-file-contents filename (let ((metadata (org-export-get-environment 'ennum-html)) (export (apply-partially 'org-export-with-backend 'ennum-html))) - (dolist (key ennum-mandatory-metadata) + (dolist (key (ennum-setting :required-metadata)) (unless (plist-member metadata key) (user-error "Metadata %s not specified" key))) (let* ((tree (org-element-parse-buffer)) @@ -428,9 +434,6 @@ the current state of all its variables." :translation-group (or (plist-get metadata :translation-group) (file-name-base filename))))))) -(defvar ennum-mandatory-metadata - (list :title :date)) - (defun ennum-directory-files (&optional directory full include-directories) "Return recursively the list of all files under DIRECTORY. Files are returned in depth first order. @@ -663,7 +666,8 @@ result as a string." :blog-scheme :index-posts-per-page :image-width :image-link-width :locale-alist :other-files-directory - :store :tag-directory :image-thumbnail-width) + :store :tag-directory :image-thumbnail-width + :required-metadata) (plist-get (org-combine-plists (list :atom-feed-number-of-posts 12 :atom-feed-file "blog.atom" @@ -674,7 +678,8 @@ result as a string." :locale-alist '(("en" . "C")) :store ".ennum" :tag-directory "tag" - :image-thumbnail-width 320) + :image-thumbnail-width 320 + :required-metadata (list :title :date)) ennum-blog) property)) (_ (error "Unknown property %s" property)))) |