memory-leaks

Still reachable: lots of words in many pages.
git clone https://git.kevinlegouguec.net/memory-leaks
Log | Files | Refs | README | LICENSE

commit 9dceda02d10adcabec2504da8e39cefa2e5b0336
parent 348ac65f367ec3b0ce4a517a281810e5c82bd135
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Tue,  6 Oct 2020 11:00:24 +0200

Handle link abbreviations

Diffstat:
Mrepo/www/preprocess-org.el | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/repo/www/preprocess-org.el b/repo/www/preprocess-org.el @@ -1,3 +1,5 @@ +;; -*- lexical-binding: t -*- + ;; How I Convert Org Files To HTML. ;; ================================ ;; @@ -48,5 +50,14 @@ (insert "#+end_tags\n"))))) ;; TODO: dump properties ;; TODO: fontify TODO keywords - ;; TODO: expand #+LINK abbreviations + (pcase-dolist (`(,key . ,expansion) org-link-abbrev-alist-local) + (goto-char (point-min)) + (let ((link-re (rx "[[" (group (literal key) ":" + (group (+ (not "]")))))) + (replacement (if (string-match-p "%s" expansion) + (lambda (tag) (format expansion tag)) + (lambda (tag) (concat expansion tag))))) + (while (re-search-forward link-re nil t) + (let ((full-link (funcall replacement (match-string 2)))) + (replace-match full-link t t nil 1))))) (princ (buffer-string))))