Skip to content

Instantly share code, notes, and snippets.

Created June 16, 2021 14:08
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Elisp script with functions to export my notes to Hugo-markdown with ox-hugo
;;; publish --- Summary
;;; Commentary:
(require 'find-lisp)
;;; Code:
(defun hugcis/publish-note (file)
"Publish a note in FILE."
(with-current-buffer (find-file-noselect file)
(projectile-mode -1)
(setq org-hugo-section "notes"
org-hugo-base-dir "~/website/personal-website/"
citeproc-org-org-bib-header "* Bibliography\n<ol class=\"biblio-list\">"
citeproc-org-org-bib-footer "</ol>")
(let ((org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$")))
(defun hugcis/delete-current-line ()
"Delete (not kill) the current line."
(progn (forward-visible-line 0) (point))
(progn (forward-visible-line 1) (point)))))
(defun hugcis/publish-lines (filename)
(with-current-buffer (find-file-noselect filename)
(goto-char (point-max))
(while (> (point) (point-min))
(forward-line -1)
(let ((org-fname (message (thing-at-point 'line t))))
(if org-fname ;; if line is empty
(hugcis/publish-note (replace-regexp-in-string "\n$" "" org-fname))))
(provide 'publish)
;;; publish.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment