summaryrefslogtreecommitdiff
path: root/org-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-09-03 16:07:40 +0800
committerJSDurand <mmemmew@gmail.com>2022-09-03 16:07:40 +0800
commitb221c62a2521a240761f6ac023cdfd6b33c2a010 (patch)
treecccaddee8e09d8a1e157e06cb870990229511fcd /org-conf.el
parent52a52c0a55bcf48df492a42844b5245a2156a46a (diff)
org: exclude "11bus-en" from the sitemap.
* org-conf.el (durand-org-publish-sitemap, durand-org-publish-sitemap-format): The article 11bus-en is an English version of the article 11bus, so the sitemap should not list the conceptually equivalent article more than once. This requires the sitemap generation to skip that article, and to delete some redundant separation markers left behind. The latter is necessary since the sitemap generator still genetates separtors for empty entries, and would mess up the format otherwise.
Diffstat (limited to 'org-conf.el')
-rw-r--r--org-conf.el38
1 files changed, 24 insertions, 14 deletions
diff --git a/org-conf.el b/org-conf.el
index c2afc19..604a3ea 100644
--- a/org-conf.el
+++ b/org-conf.el
@@ -804,14 +804,20 @@ project. Use such functions as `org-list-to-org' or
title
"#+HTML_LINK_UP: index.html"
(format-time-string "%F %a %R")
- (cadr (assoc title durand-sitemap-custom-string-alist #'string=))
+ (cadr
+ (assoc title durand-sitemap-custom-string-alist #'string=))
;; generate a table
- (org-list-to-generic
- rep
- '(:ustart "|---|"
- :uend "|---|"
- :isep "|---|"))
- (caddr (assoc title durand-sitemap-custom-string-alist #'string=))))
+ (replace-regexp-in-string
+ (rx-to-string '(seq "|---|" (one-or-more space) "|---|"))
+ "|---|"
+ (org-list-to-generic
+ rep
+ '(:ustart "|---|"
+ :uend "|---|"
+ :isep "|---|")))
+ (caddr
+ (assoc title durand-sitemap-custom-string-alist
+ #'string=))))
;;;;; Custom sitemap format
@@ -829,13 +835,17 @@ ENTRY is the entry file name to format.
STYLE is either 'list or 'tree, which is ignored by us.
PROJECT is the current project."
- (format "| %s | [[file:%s][%s]] |"
- (format-time-string
- "%FT%T%z"
- (org-publish-find-date entry project)
- (current-time-zone))
- entry
- (org-publish-find-title entry project)))
+ (cond
+ ;; I might want to add an "exclude-list" later if more articles
+ ;; require to be excluded from the sitemap file.
+ ((string-match-p "11bus-en" entry) "")
+ ((format "| %s | [[file:%s][%s]] |"
+ (format-time-string
+ "%FT%T%z"
+ (org-publish-find-date entry project)
+ (current-time-zone))
+ entry
+ (org-publish-find-title entry project)))))
;;;; Post-processing