changeset 665: |
c60decbaae3d |
parent: |
39170f311b8c
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 22 Sep 2024 21:29:15 -0400 |
permissions: |
-rw-r--r-- |
description: |
more graph updates |
1 ;;; publish.el --- the.compiler.company publishing script -*- lexical-binding:t -*- 3 ;; emacsclient -e '(load-file "publish.el")' '(publish)' 12 (defvar project-dir "~/comp/org") 13 (defvar publish-dir "/tmp/www") 14 (defvar html-theme nil) 15 (defvar url "https://compiler.company") 16 (defvar vc-url "https://vc.compiler.company") 17 (defvar packy-url "https://packy.compiler.company") 18 (defvar html-foot "<footer><p>updated %C</p></footer>") 20 ;; (setq org-protocol-project-alist 23 ;; :working-directory project-dir 24 ;; :online-suffix ".html" 25 ;; :working-suffix ".org"))) 27 (setq org-html-style-default "" 28 ;; 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 39 org-id-link-to-org-use-id t 40 org-html-klipsify-src nil) 42 (setq org-html-klipse-selection-script 43 "window.klipse_settings = {selector_eval_html: '.src-html', 44 selector_eval_js: '.src-js', 45 selector_eval_python_client: '.src-python', 46 selector_eval_scheme: '.src-scheme', 47 selector: '.src-clojure', 48 selector_eval_ruby: '.src-ruby', 49 selector_eval_clisp: '.src-lisp'};") 51 (setq org-html-link-home url) 53 (setq org-html-home/up-format "<nav id=\"org-div-home-and-up\"><a href=\"%s\" accesskey=\"h\"><button class=home>⌂</button></a><a href=\"%s\" accesskey=\"u\"><button class=up>▲</button></a> 54 <button accesskey=\"s\" class=show onclick=open_all_sections()>show</button> <button accesskey=\"x\" class=hide onclick=close_all_sections()>hide</button></nav>") 56 (setq org-publish-project-alist 57 `(("compiler.company" :components ("index" "meta" "blog" "docs" "notes" "plan")) 59 :base-directory ,project-dir 64 :html-doctype "<!doctype html>" 65 :html-postamble ,html-foot 66 :publishing-directory ,publish-dir 67 :publishing-function org-html-publish-to-html) 69 :base-directory ,(expand-file-name "meta" project-dir) 73 :html-doctype "<!doctype html>" 74 :publishing-directory ,(expand-file-name "meta" publish-dir) 75 :publishing-function org-html-publish-to-html 77 :html-postamble ,html-foot) 79 :base-directory ,(expand-file-name "blog" project-dir) 83 :html-doctype "<!doctype html>" 84 :publishing-directory ,(expand-file-name "blog" publish-dir) 85 :publishing-function org-html-publish-to-html 87 :html-postamble ,html-foot) 89 :base-directory ,(expand-file-name "plan" project-dir) 93 :html-doctype "<!doctype html>" 94 :publishing-directory ,(expand-file-name "plan" publish-dir) 95 :publishing-function org-html-publish-to-html 97 :html-postamble ,html-foot) 99 :base-directory ,(expand-file-name "notes" project-dir) 101 :base-extension "org" 102 :footnote-section-p t 103 :html-doctype "<!doctype html>" 104 :publishing-directory ,(expand-file-name "notes" publish-dir) 105 :publishing-function org-html-publish-to-html 107 :html-postamble ,html-foot) 109 :base-directory ,(expand-file-name "docs" project-dir) 110 :base-extension "org" 112 :footnote-section-p t 113 :html-doctype "<!doctype html>" 114 :publishing-directory ,(expand-file-name "docs" publish-dir) 115 :publishing-function org-html-publish-to-html 117 :html-postamble ,html-foot))) 119 ;; (defun org-export-get-reference-title (datum info) 120 ;; "Like `org-export-get-reference', except uses heading titles instead of random numbers." 121 ;; (let ((cache (plist-get info :internal-references))) 122 ;; (or (car (rassq datum cache)) 123 ;; (let* ((crossrefs (plist-get info :crossrefs)) 124 ;; (cells (org-export-search-cells datum)) 125 ;; ;; Preserve any pre-existing association between 126 ;; ;; a search cell and a reference, i.e., when some 127 ;; ;; previously published document referenced a location 128 ;; ;; within current file (see 129 ;; ;; `org-publish-resolve-external-link'). 131 ;; ;; However, there is no guarantee that search cells are 132 ;; ;; unique, e.g., there might be duplicate custom ID or 133 ;; ;; two headings with the same title in the file. 135 ;; ;; As a consequence, before re-using any reference to 136 ;; ;; an element or object, we check that it doesn't refer 137 ;; ;; to a previous element or object. 140 ;; (let ((stored (cdr (assoc cell crossrefs)))) 142 ;; (let ((old (org-export-format-reference stored))) 143 ;; (and (not (assoc old cache)) stored))))) 145 ;; (when (org-element-property :raw-value datum) 146 ;; ;; Heading with a title 147 ;; (org-export-new-title-reference datum cache)) 148 ;; ;; NOTE: This probably breaks some Org Export 149 ;; ;; feature, but if it does what I need, fine. 150 ;; (org-export-format-reference 151 ;; (org-export-new-reference cache)))) 152 ;; (reference-string new)) 153 ;; ;; Cache contains both data already associated to 154 ;; ;; a reference and in-use internal references, so as to make 155 ;; ;; unique references. 156 ;; (dolist (cell cells) (push (cons cell new) cache)) 157 ;; ;; Retain a direct association between reference string and 158 ;; ;; DATUM since (1) not every object or element can be given 159 ;; ;; a search cell (2) it permits quick lookup. 160 ;; (push (cons reference-string datum) cache) 161 ;; (plist-put info :internal-references cache) 162 ;; reference-string)))) 164 ;; (defun org-export-new-title-reference (datum cache) 165 ;; "Return new reference for DATUM that is unique in CACHE." 166 ;; (cl-macrolet ((inc-suffixf (place) 168 ;; (string-match (rx bos 169 ;; (minimal-match (group (1+ anything))) 170 ;; (optional "--" (group (1+ digit))) 173 ;; ;; HACK: `s1' instead of a gensym. 174 ;; (-let* (((s1 suffix) (list (match-string 1 ,place) 175 ;; (match-string 2 ,place))) 176 ;; (suffix (if suffix 177 ;; (string-to-number suffix) 179 ;; (setf ,place (format "%s--%s" s1 (cl-incf suffix))))))) 180 ;; (let* ((title (org-element-property :raw-value datum)) 181 ;; (ref (url-hexify-string (substring-no-properties title))) 182 ;; (parent (org-element-property :parent datum))) 183 ;; (while (--any (equal ref (car it)) 185 ;; ;; Title not unique: make it so. 187 ;; ;; Append ancestor title. 188 ;; (setf title (concat (org-element-property :raw-value parent) 190 ;; ref (url-hexify-string (substring-no-properties title)) 191 ;; parent (org-element-property :parent parent)) 192 ;; ;; No more ancestors: add and increment a number. 193 ;; (inc-suffixf ref))) 197 (defun publish (&optional sitemap static force async) 198 "publish `compiler.company' content. 199 If STATIC is t, also publish media and static files. 200 If FORCE is t, skip checking file mod date and just publish all files. 201 If ASYNC is t, call `org-publish' asynchronously. 202 If given a prefix (C-u), set all args to t" 204 (if current-prefix-arg 208 (let ((default-directory project-dir)) 209 (message (format "publishing from %s" default-directory)) 210 (org-publish "compiler.company" force async))) 213 ;;; publish.el ends here