-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.el
executable file
·83 lines (65 loc) · 2.69 KB
/
publish.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env sh
":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
;; Inspiration:
;; https://github.com/tecosaur/this-month-in-org/blob/master/publish.el
;; https://gitlab.com/ngm/commonplace/-/blob/master/publish.el
(pop argv) ; $0
(setq force (string= "-f" (pop argv)))
(unless (bound-and-true-p doom-init-p)
(setq gc-cons-threshold 16777216
gcmh-high-cons-threshold 16777216)
;; (setq org-src-fontify-natively t)
;; (setq doom-disabled-packages '(doom-themes))
(load (expand-file-name "core/core.el" user-emacs-directory) nil t)
(require 'core-cli)
(doom-initialize)
(load (expand-file-name "core/core-ui.el" user-emacs-directory) nil t)
(require 'core-ui)
(load-theme 'doom-opera-light t))
(require 'find-lisp)
(require 'dash)
(require 's)
(require 'rustic)
(require 'elisp-mode)
(require 'htmlize)
(require 'org-roam)
(require 'ox-publish)
(require 'ox-html)
(require 'oc-csl)
(setq org-babel-default-header-args
(cons '(:exports . "both") ;; export code and results by default
(cons '(:eval . "no-export") ;; don't evaluate src blocks when exporting
(assq-delete-all :exports
(assq-delete-all :eval org-babel-default-header-args)))))
(advice-add 'undo-tree-mode :override #'ignore) ; Undo tree is a pain
;;; Silence uninformative noise
(advice-add 'org-toggle-pretty-entities :around #'doom-shut-up-a)
(advice-add 'indent-region :around #'doom-shut-up-a)
(advice-add 'rng-what-schema :around #'doom-shut-up-a)
(advice-add 'ispell-init-process :around #'doom-shut-up-a)
;;; No recentf please
(recentf-mode -1)
(advice-add 'recentf-mode :override #'ignore)
(advice-add 'recentf-cleanup :override #'ignore)
(section! "Initializing")
(setq org-html-htmlize-output-type 'css)
(setq org-roam-directory "~/garden-simple/org/")
(setq org-roam-db-location (concat org-roam-directory "org-roam.db"))
(load-file "~/garden-simple/publish-utils.el")
(section! "Publishing files")
(when force
(warn! "Force flag set"))
(when force
(mapcar 'delete-file (file-expand-wildcards "~/garden-simple/html/*.html")))
(let ((org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$")))
(org-publish "digital laboratory" force))
(let ((css-src (expand-file-name "~/garden-simple/css/styles.css"))
(css-dest (expand-file-name "~/garden-simple/html/styles.css")))
(when (file-newer-than-file-p css-src css-dest)
(message "Copying styles.css...")
(copy-file css-src css-dest t)))
(let ((css-src (expand-file-name "~/garden-simple/css/syntax.css"))
(css-dest (expand-file-name "~/garden-simple/html/syntax.css")))
(when (file-newer-than-file-p css-src css-dest)
(message "Copying syntax.css...")
(copy-file css-src css-dest t)))