summaryrefslogtreecommitdiff
path: root/org-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'org-conf.el')
-rw-r--r--org-conf.el63
1 files changed, 62 insertions, 1 deletions
diff --git a/org-conf.el b/org-conf.el
index 6287658..95b4150 100644
--- a/org-conf.el
+++ b/org-conf.el
@@ -381,7 +381,7 @@ in Lisp code use `org-set-tags' instead."
;;; Accounts
-(load-file "account.el")
+;; (load-file "account.el")
;; ;;;###autoload
;; (defvar durand-org-capture-account-which-list
@@ -1163,6 +1163,67 @@ title."
(advice-add #'org-html-publish-to-html :filter-return #'durand-org-publish-html-advice)
+;;;; Author element in quotes
+
+;; I want to note the author in quotes, and have the authors stand out
+;; a little.
+
+(defun durand-org-quote-export-filter (text backend _info)
+ "Turn ending lines beginning with two dashes into footer elements.
+The parameters TEXT, BACKEND, and INFO are subject to the rules of
+`org-export-filter-quote-block-functions'."
+ (cond
+ ((org-export-derived-backend-p backend 'html)
+ (message "text: %s" text)
+ (replace-regexp-in-string
+ (rx-to-string
+ (list 'seq 'bol "-#- "
+ (list 'group-n 1 (list 'one-or-more 'anychar))
+ "</p>")
+ t)
+ "<footer><cite>\\1</cite></footer>"
+ text))))
+
+(add-to-list 'org-export-filter-quote-block-functions
+ #'durand-org-quote-export-filter)
+
+;;;; Remove spaces between Chinese characters
+
+(defun durand-org-no-chinese-spaces (text backend _info)
+ "Remove extra spaces caused by line breaks between Chinese
+characters.
+
+The parameters TEXT, BACKEND, and INFO are subject to the rules of
+`org-export-filter-quote-block-functions'."
+ (cond
+ ((org-export-derived-backend-p backend 'html)
+ (let ((regex (rx-to-string
+ (list
+ 'seq
+ (list
+ 'or
+ (list 'category 'korean-hangul-two-byte)
+ (list 'category 'chinese)
+ (list 'category 'korean)
+ (list 'category 'japanese)
+ (list 'category 'japanese-katakana)))
+ t)))
+ (setq text (replace-regexp-in-string
+ (format "\\(%s\\) *\n *\\(%s\\)" regex regex)
+ "\\1\\2" text))
+ ;; Handle extra spaces at boundaries between Chinese and
+ ;; non-Chinese.
+ (setq text (replace-regexp-in-string
+ (format "\\(%s\\) *\n" regex)
+ "\\1" text))
+ (setq text (replace-regexp-in-string
+ (format "\n *\\(%s\\)" regex)
+ "\\1" text))))
+ text))
+
+(add-to-list 'org-export-filter-paragraph-functions
+ #'durand-org-no-chinese-spaces)
+
;;;; Atom feed
;;;;; Fixed pre-amble, template, and post-amble.