about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ennum.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/ennum.el b/ennum.el
index 46d4bd1..28109a5 100644
--- a/ennum.el
+++ b/ennum.el
@@ -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))))