changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / emacs/lib/publish.el

changeset 588: 0552341ac196
parent: 7efdeaebaf22
child: 74a55d5decce
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 12 Aug 2024 18:32:35 -0400
permissions: -rw-r--r--
description: refactor org-id stuff to ulang, pkgbuild notes
1 ;;; publish.el --- the.compiler.company publishing script -*- lexical-binding:t -*-
2 
3 ;; emacsclient -e '(load-file "publish.el")' '(publish)'
4 
5 ;;; Code:
6 (require 'ox-publish)
7 (require 'org-id)
8 ;; vendored
9 (require 'htmlize)
10 (defvar project-dir "~/comp/org")
11 (defvar publish-dir "/tmp/www")
12 (defvar html-theme nil)
13 (defvar url "https://compiler.company")
14 (defvar vc-url "https://vc.compiler.company")
15 (defvar packy-url "https://packy.compiler.company")
16 (defvar html-nav (format "<div class=\"nav\" id=\"nav\"><h2 id=\"index\">*</h2><div id=\"text-index\"> (<a href = \"%s\">~</a><br> (<a href = \"%s/blog\">blog</a> <a href = \"%s/docs\">docs</a> <a href = \"%s/plan\">plan</a> <a href = \"%s/notes\">notes</a>)<br> (<a href = \"%s\">vc</a> <a href = \"%s\">packy</a>))</div></div>"
17  url url url url url vc-url packy-url))
18 
19 (defvar html-foot "<footer><p>updated %C</p></footer>")
20 
21 ;; (setq org-protocol-project-alist
22 ;; '(("comp"
23 ;; :base-url url
24 ;; :working-directory project-dir
25 ;; :online-suffix ".html"
26 ;; :working-suffix ".org")))
27 
28 (setq org-html-style-default ""
29  org-html-scripts ""
30  org-html-htmlize-output-type 'css
31  org-export-htmlize-output-type 'css
32  org-export-allow-bind-keywords t
33  org-html-doctype "html5"
34  org-html-html5-fancy t
35  org-html-validation-link nil
36  org-src-fontify-natively t
37  make-backup-files nil
38  debug-on-error t
39  org-id-link-to-org-use-id t)
40 
41 (setq org-publish-project-alist
42  `(("compiler.company" :components ("index" "meta" "blog" "docs" "notes" "plan"))
43  ("index"
44  :base-directory ,project-dir
45  :base-extension "org"
46  :recursive nil
47  :htmlized-source t
48  :footnote-section-p t
49  :html-doctype "<!doctype html>"
50  ;; :html-preamble ,html-nav
51  :html-postamble ,html-foot
52  :publishing-directory ,publish-dir
53  :publishing-function org-html-publish-to-html)
54  ("meta"
55  :base-directory ,(expand-file-name "meta" project-dir)
56  :base-extension "org"
57  :recursive t
58  :footnote-section-p t
59  :html-doctype "<!doctype html>"
60  :publishing-directory ,(expand-file-name "meta" publish-dir)
61  :publishing-function org-html-publish-to-html
62  :htmlized-source t
63  :html-preamble ,html-nav
64  :html-postamble ,html-foot)
65  ("blog"
66  :base-directory ,(expand-file-name "blog" project-dir)
67  :recursive t
68  :base-extension "org"
69  :footnote-section-p t
70  :html-doctype "<!doctype html>"
71  :publishing-directory ,(expand-file-name "blog" publish-dir)
72  :publishing-function org-html-publish-to-html
73  :htmlized-source t
74  :html-preamble ,html-nav
75  :html-postamble ,html-foot)
76  ("plan"
77  :base-directory ,(expand-file-name "plan" project-dir)
78  :recursive t
79  :base-extension "org"
80  :footnote-section-p t
81  :html-doctype "<!doctype html>"
82  :publishing-directory ,(expand-file-name "plan" publish-dir)
83  :publishing-function org-html-publish-to-html
84  :htmlized-source t
85  :html-preamble ,html-nav
86  :html-postamble ,html-foot)
87  ("notes"
88  :base-directory ,(expand-file-name "notes" project-dir)
89  :recursive t
90  :base-extension "org"
91  :footnote-section-p t
92  :html-doctype "<!doctype html>"
93  :publishing-directory ,(expand-file-name "notes" publish-dir)
94  :publishing-function org-html-publish-to-html
95  :htmlized-source t
96  :html-preamble ,html-nav
97  :html-postamble ,html-foot)
98  ("docs"
99  :base-directory ,(expand-file-name "docs" project-dir)
100  :base-extension "org"
101  :recursive t
102  :footnote-section-p t
103  :html-doctype "<!doctype html>"
104  :publishing-directory ,(expand-file-name "docs" publish-dir)
105  :publishing-function org-html-publish-to-html
106  :htmlized-source t
107  :html-preamble ,html-nav
108  :html-postamble ,html-foot)))
109 
110 ;;;###autoload
111 (defun publish (&optional sitemap static force async)
112  "publish `rwest-io' content.
113 If STATIC is t, also publish media and static files.
114 If FORCE is t, skip checking file mod date and just publish all files.
115 If ASYNC is t, call `org-publish' asynchronously.
116 If given a prefix (C-u), set all args to t"
117  (interactive)
118  (if current-prefix-arg
119  (setq static t
120  force t
121  async t))
122  (let ((default-directory project-dir))
123  (message (format "publishing from %s" default-directory))
124  (org-publish "compiler.company" force async)))