Add function that generates index.org before publishing rss
This commit is contained in:
parent
839c53448b
commit
30a4eda7d3
4 changed files with 29 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
/.cask
|
/.cask
|
||||||
/public
|
/public
|
||||||
/.org-timestamps
|
/.org-timestamps
|
||||||
|
/posts/index.org
|
||||||
|
|
||||||
# Added automatically by `eldev init'.
|
# Added automatically by `eldev init'.
|
||||||
/.eldev
|
/.eldev
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#+comment_status: closed
|
#+comment_status: closed
|
||||||
#+status: publish
|
#+status: publish
|
||||||
#+UPDATE_URL: /admin/modify-post/2023%252f07%252f10%252fswitch-todo-state-when-clocking-in
|
#+UPDATE_URL: /admin/modify-post/2023%252f07%252f10%252fswitch-todo-state-when-clocking-in
|
||||||
#+DATE: Mon, 10 Jul 2023 05:56:39 GMT
|
# #+DATE: Mon, 10 Jul 2023 05:56:39 GMT
|
||||||
|
#+DATE: [2023-07-10 Mon 05:56]
|
||||||
#+exclude_tags: summary
|
#+exclude_tags: summary
|
||||||
|
|
||||||
This Emacs configuration snippet for org-mode changes a task's state from whatever “head” state it's in into the next state in its sequence when you clock in to a task. I do this by setting the =org-clock-in-switch-to-state= variable.
|
This Emacs configuration snippet for org-mode changes a task's state from whatever “head” state it's in into the next state in its sequence when you clock in to a task. I do this by setting the =org-clock-in-switch-to-state= variable.
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#+title: posts
|
|
||||||
#+select_tags: summary
|
|
||||||
#+options: tags:nil num:nil
|
|
||||||
|
|
||||||
#+include: "./20230610-0556-switch-todo-state-when-clocking-in.org::*Switch TODO state when clocking in"
|
|
||||||
#+include: "./20230412-0702-paredit-and-ielm.org::*IELM & Paredit"
|
|
||||||
#+include: "./20200223-1828-a-very-important-blog-post.org::*A very important blog post"
|
|
||||||
#+include: "./20191006-1818-my-new-emacs-configuration.org::*My new Emacs configuration"
|
|
||||||
#+include: "./20191006-1255-new-blog.org::*New Blog"
|
|
||||||
#+include: "./20160221-0000-wdocker-compose.org::*Making docker-compose easier with wdocker"
|
|
26
publish.el
26
publish.el
|
@ -52,6 +52,29 @@
|
||||||
time
|
time
|
||||||
(if (= time 1) "" "s")))
|
(if (= time 1) "" "s")))
|
||||||
|
|
||||||
|
(defun publish-generate-index (props)
|
||||||
|
"Generate an index from my posts.
|
||||||
|
Argument PROPS
|
||||||
|
."
|
||||||
|
(let ((files (directory-files "posts/" t (rx bos (= 8 digit) "-" (= 4 digit) "-" (one-or-more nonl) (not "~") eos))))
|
||||||
|
(with-temp-buffer
|
||||||
|
(apply 'insert
|
||||||
|
(mapcar (lambda (file)
|
||||||
|
(format "* %s\n:PROPERTIES:\n:CUSTOM_ID: %s\n:PUBDATE: %s\n:RSS_PERMALINK: %s\n:END:\n\n%s[[file:%s][Read More]]\n\n"
|
||||||
|
(car (org-publish-find-property file :title props))
|
||||||
|
(file-name-nondirectory file)
|
||||||
|
(format-time-string "[%Y-%m-%d %a %H:%M]" (org-timestamp-to-time (car (org-publish-find-property file :date props))))
|
||||||
|
(file-name-nondirectory file)
|
||||||
|
(car (org-map-entries (lambda () (let ((element-data (cadr (org-element-at-point))))
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(map-elt element-data :contents-begin)
|
||||||
|
(map-elt element-data :contents-end))))
|
||||||
|
"summary"
|
||||||
|
(list file)))
|
||||||
|
(file-name-nondirectory file)))
|
||||||
|
(take 30 (reverse files))))
|
||||||
|
(write-file "posts/index.org"))))
|
||||||
|
|
||||||
(setq org-export-exclude-tags '("noexport" "draft"))
|
(setq org-export-exclude-tags '("noexport" "draft"))
|
||||||
|
|
||||||
(setq org-confirm-babel-evaluate nil)
|
(setq org-confirm-babel-evaluate nil)
|
||||||
|
@ -99,8 +122,11 @@
|
||||||
:base-directory "posts/"
|
:base-directory "posts/"
|
||||||
:base-extension "org"
|
:base-extension "org"
|
||||||
:rss-extension "xml"
|
:rss-extension "xml"
|
||||||
|
:preparation-function publish-generate-index
|
||||||
:publishing-directory "public/posts/"
|
:publishing-directory "public/posts/"
|
||||||
:publishing-function (org-rss-publish-to-rss)
|
:publishing-function (org-rss-publish-to-rss)
|
||||||
|
:html-link-home "https://ryuslash.org/posts/"
|
||||||
|
:html-link-use-abs-url t
|
||||||
:section-numbers nil
|
:section-numbers nil
|
||||||
:exclude ".*"
|
:exclude ".*"
|
||||||
:include ("index.org")
|
:include ("index.org")
|
||||||
|
|
Loading…
Reference in a new issue