Add possibility to mark posts as drafts
This way they won't get included in the lists or RSS, but they'll still get exported and posted.
This commit is contained in:
parent
ab5d3c0a5d
commit
12ec5be353
1 changed files with 29 additions and 20 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
(load "../common.el")
|
||||
|
||||
(cl-defstruct orgweb:post filename title date tags contents)
|
||||
(cl-defstruct orgweb:post filename title date tags contents draft)
|
||||
|
||||
(defun orgweb-get-permalink (entry)
|
||||
(let ((entry-date (org-date-to-gregorian (orgweb:post-date entry))))
|
||||
|
@ -31,6 +31,12 @@
|
|||
(when (org-forward-heading-same-level 1)
|
||||
(org-get-tags))))
|
||||
|
||||
(defun orgweb-get-draft ()
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(org-forward-heading-same-level 1)
|
||||
(org-entry-get (point) "DRAFT")))
|
||||
|
||||
(defun orgweb-get-entries ()
|
||||
(delq nil
|
||||
(mapcar (lambda (orgfile)
|
||||
|
@ -45,7 +51,8 @@
|
|||
:date date
|
||||
:tags (orgweb-get-tags)
|
||||
:contents (buffer-substring-no-properties
|
||||
(point-min) (point-max)))))))
|
||||
(point-min) (point-max))
|
||||
:draft (orgweb-get-draft))))))
|
||||
(directory-files "/home/slash/projects/orgweb/articles"
|
||||
t "^[^.].*\\.org$"))))
|
||||
|
||||
|
@ -61,8 +68,9 @@
|
|||
(defun orgweb-shortlist (entries)
|
||||
(with-temp-buffer
|
||||
(mapc (lambda (entry)
|
||||
(unless (orgweb:post-draft entry)
|
||||
(insert "* " (orgweb-link entry "articles/") " "
|
||||
(orgweb:post-date entry) "\n"))
|
||||
(orgweb:post-date entry) "\n")))
|
||||
entries)
|
||||
(write-file "shortlist.org")))
|
||||
|
||||
|
@ -70,6 +78,7 @@
|
|||
(with-temp-buffer
|
||||
(insert "#+TITLE:\n#+OPTIONS: toc:nil\n\n")
|
||||
(mapc (lambda (entry)
|
||||
(unless (orgweb:post-draft entry)
|
||||
(insert
|
||||
(with-temp-buffer
|
||||
(insert (orgweb:post-contents entry))
|
||||
|
@ -85,7 +94,7 @@
|
|||
(orgweb-get-permalink entry)))
|
||||
(buffer-substring-no-properties
|
||||
heading-start (point))))
|
||||
"\n\n")
|
||||
"\n\n"))
|
||||
(let* ((gdate (org-date-to-gregorian
|
||||
(orgweb:post-date entry)))
|
||||
(date-tree (format "_build/%s/%s/%s"
|
||||
|
|
Loading…
Reference in a new issue