changeset 15: |
27795b18326b |
parent: |
06842841bf42
|
child: |
ab1f674742a8 |
author: |
ellis <ellis@rwest.io> |
date: |
Fri, 24 Nov 2023 22:39:07 -0500 |
permissions: |
-rw-r--r-- |
description: |
blog update |
1 ;;; publish.el --- the.compiler.company publishing script -*- lexical-binding: t; -*- 3 ;; emacsclient -e '(load-file "publish.el")' '(publish)' 10 (defvar project-dir "~/dev/comp/org") 11 (defvar publish-dir "/mnt/w/compiler.company") 12 (defvar html-theme nil) 13 (defvar url "https://compiler.company") 14 (defvar html-nav "<div> <a href = \"https://compiler.company\">~/</a> ( <a href = \"https://compiler.company/blog\">blog</a> <a href = \"https://compiler.company/docs\">docs</a> <a href = \"https://vc.compiler.company/comp\">code</a> ) </div>") 16 (defvar html-foot "<footer>updated %C</footer>") 18 (setq org-html-style-default "" 20 org-html-htmlize-output-type 'css 21 org-export-htmlize-output-type 'css 22 org-html-doctype "html5" 23 org-html-html5-fancy t 24 org-html-validation-link nil 25 org-src-fontify-natively t 28 org-id-link-to-org-use-id t) 30 (setq org-publish-project-alist 31 `(("compiler.company" :components ("index" "blog" "docs")) 33 :base-directory ,project-dir 37 :html-preamble ,html-nav 38 :publishing-directory ,publish-dir 39 :publishing-function org-html-publish-to-html 40 :html-postamble ,html-foot) 42 :base-directory ,(expand-file-name "blog" project-dir) 44 :publishing-directory ,(expand-file-name "blog" publish-dir) 45 :publishing-function org-html-publish-to-html 47 :html-preamble ,html-nav 48 :html-postamble ,html-foot) 50 :base-directory ,(expand-file-name "docs" project-dir) 53 :publishing-directory ,(expand-file-name "docs" publish-dir) 54 :publishing-function org-html-publish-to-html 56 :html-preamble ,html-nav 57 :html-postamble ,html-foot))) 59 (defun org-custom-id-get (&optional pom create prefix) 60 "Get the CUSTOM_ID property of the entry at point-or-marker POM. 61 If POM is nil, refer to the entry at point. If the entry does 62 not have an CUSTOM_ID, the function returns nil. However, when 63 CREATE is non nil, create a CUSTOM_ID if none is present 64 already. PREFIX will be passed through to `org-id-new'. In any 65 case, the CUSTOM_ID of the entry is returned." 67 (org-with-point-at pom 68 (let ((id (org-entry-get nil "CUSTOM_ID")) 69 ;; use CUSTOM_ID for links 70 (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) 72 ((and id (stringp id) (string-match "\\S-" id)) 75 (setq id (org-id-new prefix)) 76 (org-entry-put pom "CUSTOM_ID" id) 77 (org-id-add-location id (buffer-file-name (buffer-base-buffer))) 80 (defun org-id-add-to-headlines-in-file () 81 "Add CUSTOM_ID properties to all headlines in the 82 current file which do not already have one." 84 (org-map-entries (lambda () (org-custom-id-get (point) 'create)))) 87 (defun publish (&optional sitemap static force async) 88 "publish `rwest-io' content. 89 If STATIC is t, also publish media and static files. 90 If FORCE is t, skip checking file mod date and just publish all files. 91 If ASYNC is t, call `org-publish' asynchronously. 92 If given a prefix (C-u), set all args to t" 94 (if current-prefix-arg 98 (let ((default-directory project-dir)) 99 (message (format "publishing from %s" default-directory)) 100 (org-publish "compiler.company" force async)))