diff --git a/create-site.el b/create-site.el index 7f5779e..ed6a1d6 100755 --- a/create-site.el +++ b/create-site.el @@ -28,7 +28,57 @@ (package-install 'htmlize) (package-install 'ox-gemini) +;; ox-hugo for exocortex notes +(use-package ox-hugo + :ensure t ;Auto-install the package from Melpa + :pin melpa ;`package-archives' should already have ("melpa" . "https://melpa.org/packages/") + :after ox + :config + (setq org-hugo-base-dir "~/projects/cosmicflow.space/public/exocortex-hugo-md" ) + (setq org-hugo-default-section-directory "braindump") + ) +(setq org-roam-directory "~/projects/notes/") +;; modified this function from https://github.com/kaushalmodi/ox-hugo/discussions/585#discussioncomment-2335203 +(defun ox-hugo/export-all (&optional org-files-root-dir dont-recurse) + "Export all Org files (including nested) under ORG-FILES-ROOT-DIR. + +All valid post subtrees in all Org files are exported using +`org-hugo-export-wim-to-md'. + +If optional arg ORG-FILES-ROOT-DIR is nil, all Org files in +current buffer's directory are exported. + +If optional arg DONT-RECURSE is nil, all Org files in +ORG-FILES-ROOT-DIR in all subdirectories are exported. Else, only +the Org files directly present in the current directory are +exported. If this function is called interactively with +\\[universal-argument] prefix, DONT-RECURSE is set to non-nil. + +Example usage in Emacs Lisp: (ox-hugo/export-all \"~/org\")." + (interactive) + (let* ((org-files-root-dir (or org-files-root-dir default-directory)) + (dont-recurse (or dont-recurse (and current-prefix-arg t))) + (search-path (file-name-as-directory (expand-file-name org-files-root-dir))) + (org-files (if dont-recurse + (directory-files search-path :full "\.org$") + (directory-files-recursively search-path "\.org$"))) + (num-files (length org-files)) + (cnt 1)) + (if (= 0 num-files) + (message (format "No Org files found in %s" search-path)) + (progn + (message (format (if dont-recurse + "[ox-hugo/export-all] Exporting %d files from %S .." + "[ox-hugo/export-all] Exporting %d files recursively from %S ..") + num-files search-path)) + (dolist (org-file org-files) + (with-current-buffer (find-file-noselect org-file) + (message (format "[ox-hugo/export-all file %d/%d] Exporting %s" cnt num-files org-file)) + (org-hugo-export-wim-to-md :all-subtrees) + (setq cnt (1+ cnt)))) + (message "Done!"))))) +(ox-hugo/export-all org-roam-directory) ;; Load the publishing system (require 'ox-publish) diff --git a/create.sh b/create.sh index 464dcbc..8e8ad37 100755 --- a/create.sh +++ b/create.sh @@ -1,11 +1,19 @@ #!/usr/bin/env sh rm -rf ./public/cosmicflow-html/ +rm -rf ./public/exocortex-hugo-md/content/ # generate the html and gemini versions of the site using org-publish emacs -Q --batch -l create-site.el rsync -avi ./content/ltximg ./public/cosmicflow-html/ +#sync exocortex notes +cd ./public/exocortex-hugo-md/ +npx quartz build +cd ../../ + +rsync -avi --delete ./public/exocortex-hugo-md/public/ ./public/cosmicflow-html/exocortex/ + # Set the source and destination directories src_dir="./public/cosmicflow-html" src_ltximg_dir="./public/cosmicflow-html/ltximg"