Updated the script to fix the all-files.org

This commit is contained in:
2026-01-04 16:42:07 +00:00
parent 8bf8810a7a
commit d841a6d615
7 changed files with 74 additions and 7 deletions

View File

@@ -247,6 +247,34 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
(setq org-html-link-home "")
(setq org-html-link-up "")
(defun z/generate-all-files-org ()
"Generate all-files.org from all-files.json."
(let* ((base-dir (expand-file-name "~/master-folder/org_files/org_roam/"))
(json-file (expand-file-name "all-files.json" base-dir))
(org-file (expand-file-name "all-files.org" base-dir)))
(when (file-exists-p json-file)
(message "🧩 Generating all-files.org from JSON…")
(let* ((json-object-type 'alist)
(json-array-type 'list)
(json-key-type 'symbol)
(data (json-read-file json-file))
(groups (alist-get 'groups data)))
(with-temp-file org-file
(insert "#+title: All Files\n")
(insert "#+options: toc:nil num:nil\n\n")
(insert "#+begin_comment\n")
(insert "This file is auto-generated. Do not edit manually.\n")
(insert "#+end_comment\n\n")
(dolist (group groups)
(let ((letter (symbol-name (car group)))
(entries (cdr group)))
(insert (format "* %s\n" letter))
(dolist (entry entries)
(let ((id (alist-get 'id entry))
(title (alist-get 'title entry)))
(insert (format "- [[id:%s][%s]]\n" id title))))
(insert "\n")))))
(message "✅ all-files.org generated"))))
(setq org-publish-project-alist
@@ -284,6 +312,7 @@ Created with %c on <a href=\"https://www.archlinux.org/\">Arch</a> <a href=\"htt
(interactive)
(setq z/build-full-rebuild t)
(org-id-update-id-locations)
(z/generate-all-files-org)
(org-publish "org-roam" t)
(org-publish "org-static" t)
(message "✅ Full rebuild complete"))