diff --git a/tekuti.el b/tekuti.el index 02b23db..ff25a4d 100644 --- a/tekuti.el +++ b/tekuti.el @@ -32,7 +32,7 @@ ;; #+TITLE: SOME TITLE ;; #+DATE: <2021-06-03 Thu 22:45> ;; #+TAGS: comma,separated -;; #+COMMENT_STATUS: open +;; #+COMMENTS: on ;; #+COMMENTS_DATE: ;; #+STATUS: publish @@ -71,6 +71,11 @@ with a ‘/’.") pair (error "Unknown post status: %s; Accepted values are: %s" status accepted-values)))) + (`("COMMENTS" ,status) + (if (string= status "on") + pair + (error "Unknown value for comments: %s; Can only be ‘on’ or not present." + status))) (_ pair))) (defun tekuti-build-data-from-org () @@ -79,22 +84,25 @@ with a ‘/’.") ("DATE" ,(tekuti--format-date)) ("TAGS") ("STATUS") - ("COMMENT_STATUS") + ("COMMENTS") ("COMMENTS-CLOSED-DATE") ("BODY"))) (data (append (mapcar #'tekuti--parse-data-keyword - (org-collect-keywords '("TITLE" "TAGS" "STATUS" "COMMENT_STATUS" "DATE" "COMMENTS_DATE"))) + (org-collect-keywords '("TITLE" "TAGS" "STATUS" "COMMENTS" "DATE" "COMMENTS_DATE"))) (list (list "BODY" (with-current-buffer (org-html-export-as-html nil nil nil t) (buffer-substring-no-properties (point-min) (point-max)))))))) - (mapcar (lambda (item) - (let ((key (car item))) - `(,key ,@(or (alist-get key data nil nil #'string=) - (cdr item))))) - defaults))) + (seq-remove + (lambda (pair) (and (string= "COMMENTS" (car pair)) + (null (cdr pair)))) + (mapcar (lambda (item) + (let ((key (car item))) + `(,key ,@(or (alist-get key data nil nil #'string=) + (cdr item))))) + defaults)))) (defun tekuti-form-encode-pair (key value) (concat (url-hexify-string key) "=" (url-hexify-string value))) @@ -114,7 +122,7 @@ with a ‘/’.") (goto-char (point-min)) (search-forward "\n\n") (backward-char) - (let ((data (org-collect-keywords '("TITLE" "TAGS" "STATUS" "COMMENT_STATUS" "DATE" "COMMENTS_DATE")))) + (let ((data (org-collect-keywords '("TITLE" "TAGS" "STATUS" "COMMENTS" "DATE" "COMMENTS_DATE")))) (mapc (lambda (item) (let ((key (car item)) (value (cadr item)))