diff options
author | Spencer Williams <spnw@plexwave.org> | 2025-07-11 13:08:35 -0400 |
---|---|---|
committer | Spencer Williams <spnw@plexwave.org> | 2025-07-11 14:16:33 -0400 |
commit | 3e6118ec43ce7b875bfa9321d6874a59f501e795 (patch) | |
tree | 942595e9f81e0c96e8ca1aeb0dc8e1917047a829 /lisp/seam-export.el | |
parent | c404b1ccf1210827c4ae8625775e5bb05884cccf (diff) |
Improve title rendering
Diffstat (limited to 'lisp/seam-export.el')
-rw-r--r-- | lisp/seam-export.el | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lisp/seam-export.el b/lisp/seam-export.el index 698d1f4..8be9404 100644 --- a/lisp/seam-export.el +++ b/lisp/seam-export.el @@ -218,6 +218,21 @@ notes)." (buffer-string))) (kill-buffer ,buf))))) +(defmacro seam-export--to-plain-string (&rest body) + (declare (indent 0)) + (let ((buf (gensym))) + `(let ((,buf (generate-new-buffer " *seam-export*"))) + (unwind-protect + (progn (with-temp-buffer + ,@body + ;; This let prevents Org from popping up a window. + (let ((org-export-show-temporary-export-buffer nil) + (org-ascii-charset 'utf-8)) + (org-export-to-buffer 'ascii ,buf nil nil nil t seam-export--options nil))) + (with-current-buffer ,buf + (buffer-string))) + (kill-buffer ,buf))))) + ;;; Some HACK-ery to get fully escaped and smartquote-ized string. (defun seam-export--escape-string (s) (string-remove-prefix @@ -227,6 +242,11 @@ notes)." (seam-export--to-string (insert s))))) +(defun seam-export--smartquotize-string (s) + (string-chop-newline + (seam-export--to-plain-string + (insert s)))) + (defun seam-export--generate-backlinks (file) (seam-export--to-string (let ((files (cl-sort @@ -250,7 +270,7 @@ notes)." (mustache-render seam-export--template `(("title" . - ,(seam-export--escape-string + ,(seam-export--smartquotize-string (seam-get-title-from-file note-file))) ("modified" . ,(format-time-string |