mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-28 19:19:50 +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-doctype "html5"
|
||||||
:html-html5-fancy t
|
:html-html5-fancy t
|
||||||
:with-sub-superscript nil
|
:with-sub-superscript nil
|
||||||
|
:section-numbers nil
|
||||||
;; :infojs-opt "path:http://thomasf.github.io/solarized-css/org-info.min.js view:showall"
|
;; :infojs-opt "path:http://thomasf.github.io/solarized-css/org-info.min.js view:showall"
|
||||||
:auto-sitemap t
|
:auto-sitemap t
|
||||||
:sitemap-filename "index.org"
|
: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/.
|
Adapted from https://org-roam.readthedocs.io/en/master/org_export/.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun my/org-roam--backlinks-list-with-content (file)
|
(defun my/org-roam--backlinks-list-with-content (file)
|
||||||
|
(when (and (stringp file) (f-file? file))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(cd (f-dirname file))
|
(cd (f-dirname file))
|
||||||
(hack-dir-local-variables-non-file-buffer)
|
(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))
|
(pcase-let ((`(,file-from _ ,props) backlink))
|
||||||
(insert (s-trim (s-replace "\n" " " (plist-get props :content))))
|
(insert (s-trim (s-replace "\n" " " (plist-get props :content))))
|
||||||
(insert "\n\n")))))))
|
(insert "\n\n")))))))
|
||||||
(buffer-string)))
|
(buffer-string))))
|
||||||
|
|
||||||
(defun my/org-export-preprocessor (backend)
|
(defun my/org-export-preprocessor (backend)
|
||||||
(let ((links (my/org-roam--backlinks-list-with-content (buffer-file-name))))
|
(let ((links (my/org-roam--backlinks-list-with-content (buffer-file-name))))
|
||||||
(unless (string= links "")
|
(unless (or (not (stringp links)) (string= links ""))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(insert (concat "\n* Backlinks\n") links)))))
|
(insert (concat "\n* Backlinks\n") links)))))
|
||||||
|
|
Loading…
Reference in a new issue