changeset 13: |
d0daa407ec13 |
child: |
06842841bf42 |
author: |
ellis <ellis@rwest.io> |
date: |
Mon, 20 Nov 2023 19:02:47 -0500 |
permissions: |
-rw-r--r-- |
description: |
org publishing |
1 ;;; publish.el --- the.compiler.company publishing script -*- lexical-binding: t; -*- 8 (defvar project-dir "~/dev/comp/org") 9 (defvar publish-dir "/mnt/w/compiler.company") 10 (defvar html-theme nil) 11 (defvar url "https://compiler.company") 12 (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>") 14 (defvar html-foot "<footer>updated %C</footer>") 16 (setq org-html-style-default "" 18 org-html-htmlize-output-type 'css 19 org-export-htmlize-output-type 'css 20 org-html-doctype "html5" 21 org-html-html5-fancy t 22 org-html-validation-link nil 23 org-src-fontify-natively t 27 (setq org-publish-project-alist 28 `(("compiler.company" :components ("index" "blog" "docs")) 30 :base-directory ,project-dir 34 :html-preamble ,html-nav 35 :publishing-directory ,publish-dir 36 :publishing-function org-html-publish-to-html 37 :html-postamble ,html-foot) 39 :base-directory ,(expand-file-name "blog" project-dir) 41 :publishing-directory ,(expand-file-name "blog" publish-dir) 42 :publishing-function org-html-publish-to-html 44 :html-preamble ,html-nav 45 :html-postamble ,html-foot) 47 :base-directory ,(expand-file-name "docs" project-dir) 50 :publishing-directory ,(expand-file-name "docs" publish-dir) 51 :publishing-function org-html-publish-to-html 53 :html-preamble ,html-nav 54 :html-postamble ,html-foot))) 56 (defun org-custom-id-get (&optional pom create prefix) 57 "Get the CUSTOM_ID property of the entry at point-or-marker POM. 58 If POM is nil, refer to the entry at point. If the entry does 59 not have an CUSTOM_ID, the function returns nil. However, when 60 CREATE is non nil, create a CUSTOM_ID if none is present 61 already. PREFIX will be passed through to `org-id-new'. In any 62 case, the CUSTOM_ID of the entry is returned." 64 (org-with-point-at pom 65 (let ((id (org-entry-get nil "CUSTOM_ID")) 66 ;; use CUSTOM_ID for links 67 (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) 69 ((and id (stringp id) (string-match "\\S-" id)) 72 (setq id (org-id-new prefix)) 73 (org-entry-put pom "CUSTOM_ID" id) 74 (org-id-add-location id (buffer-file-name (buffer-base-buffer))) 77 (defun org-id-add-to-headlines-in-file () 78 "Add CUSTOM_ID properties to all headlines in the 79 current file which do not already have one." 81 (org-map-entries (lambda () (org-custom-id-get (point) 'create)))) 84 (defun publish (&optional sitemap static force async) 85 "publish `rwest-io' content. 86 If STATIC is t, also publish media and static files. 87 If FORCE is t, skip checking file mod date and just publish all files. 88 If ASYNC is t, call `org-publish' asynchronously. 89 If given a prefix (C-u), set all args to t" 91 (if current-prefix-arg 95 (let ((default-directory project-dir)) 96 (message (format "publishing from %s" default-directory)) 97 (org-publish "compiler.company" force async)))