mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-25 03:00:05 +00:00
[emacs] Add checks to the org-roam backlink export
This commit is contained in:
parent
ab86d391f5
commit
f5b130fda8
1 changed files with 20 additions and 18 deletions
|
@ -502,6 +502,7 @@ be based on their headings.
|
|||
:html-doctype "html5"
|
||||
:html-html5-fancy t
|
||||
:with-sub-superscript nil
|
||||
:section-numbers nil
|
||||
;; :infojs-opt "path:http://thomasf.github.io/solarized-css/org-info.min.js view:showall"
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "index.org"
|
||||
|
@ -720,6 +721,7 @@ Load shared code snippets to be used in org documents.
|
|||
Adapted from https://org-roam.readthedocs.io/en/master/org_export/.
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/org-roam--backlinks-list-with-content (file)
|
||||
(when (and (stringp file) (f-file? file))
|
||||
(with-temp-buffer
|
||||
(cd (f-dirname file))
|
||||
(hack-dir-local-variables-non-file-buffer)
|
||||
|
@ -736,11 +738,11 @@ Adapted from https://org-roam.readthedocs.io/en/master/org_export/.
|
|||
(pcase-let ((`(,file-from _ ,props) backlink))
|
||||
(insert (s-trim (s-replace "\n" " " (plist-get props :content))))
|
||||
(insert "\n\n")))))))
|
||||
(buffer-string)))
|
||||
(buffer-string))))
|
||||
|
||||
(defun my/org-export-preprocessor (backend)
|
||||
(let ((links (my/org-roam--backlinks-list-with-content (buffer-file-name))))
|
||||
(unless (string= links "")
|
||||
(unless (or (not (stringp links)) (string= links ""))
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(insert (concat "\n* Backlinks\n") links)))))
|
||||
|
|
Loading…
Reference in a new issue