1 #+startup: align fold nodlcheck hidestars oddeven
2 #+title: Colophon for the Org site
7 # This file is released by its authors and contributors under the GNU
8 # Free Documentation license v1.3 or later, code examples are released
9 # under the GNU General Public License v3 or later.
12 [[https://orgmode.org][The website]] is created from org-mode documents. Just change the =.html=
13 extension of a page to =.org.html= to see the org source 😃.
14 * Creating the features screenshots
15 To produce the screenshots/screencasts in [[orgmode.org/features.html][features]], I did the following:
16 + Use the [[https://github.com/hlissner/emacs-doom-themes/tree/screenshots#doom-one-light][doom-one-light]] theme
17 + Use 24pt [[https://github.com/adobe-fonts/source-code-pro][Source Code Pro]]
18 + Use a frame 50 columns wide, and 10--20 lines tall
20 + ~(prettify-symbols-mode -1)~
21 + ~(setq org-pretty-entities nil)~
22 + ~(setq org-hide-leading-stars nil)~
23 + ~(setq org-link-descriptive nil)~
24 + ~(org-restart-font-lock)~
26 From here, I either use [[https://gitlab.com/ambrevar/emacs-gif-screencast][emacs-gif-screencast]] or the following function:
27 #+begin_src emacs-lisp
28 (defun org-screenshot-svg ()
29 "Save a screenshot of the current frame as an SVG image.
30 Saves to a file in ~/Pictures/Org and puts the filename in the kill ring."
32 (let* ((filename (expand-file-name (format-time-string "~/Pictures/Org/%H:%M.svg")))
33 (data (x-export-frames nil 'svg)))
34 (with-temp-file filename
41 For easy development, there are some little snippets which make SASS
42 recompilation, HTML exporting, and ~rsync~ all happen automatically.
43 The ="DESTINATION"= needs customising for your particular environment.
45 #+begin_src emacs-lisp :exports code :results none
46 (defvar bulk-save nil)
47 (defvar batch-export nil)
48 (defvar org-website-folder (file-name-directory (buffer-file-name)))
49 (defun org-website-sync ()
50 (let ((file-name (buffer-file-name)))
51 (when (and (s-contains-p "orgweb" file-name)
52 (not (and (s-contains-p "html" file-name)
53 (file-exists-p (s-replace ".html" ".org" file-name))))
54 (not (s-contains-p ".git" file-name))
56 (when (s-contains-p ".scss" file-name)
57 (setq sassc-output (shell-command-to-string
60 (concat (file-name-sans-extension file-name) ".css"))))
61 (unless (string-empty-p sassc-output)
62 (message "Sassc error: %s" sassc-output)))
64 (when (s-contains-p ".org" file-name)
65 (unless (string= (file-name-base file-name) "setup")
66 (let ((org-html-style-default "")
67 (org-html-scripts ""))
68 (org-html-export-to-html)))
69 (htmlize-file file-name (concat file-name ".html")))
72 (message "= Performing bulk save (triggerd by %s." file-name)
76 (temp-buffer-window-show
77 (get-buffer-create "*orgweb rsync*"))
81 (get-buffer "*orgweb rsync*")
83 "-avz" "--delete" org-website-folder "DESTINATION")
85 (when (= 0 (process-exit-status p))
86 (delete-window (get-buffer-window "*orgweb rsync*"))))))))))
88 (add-hook 'after-save-hook #'org-website-sync)
91 #+begin_src emacs-lisp :exports code :results none
92 (defun org-website-batch-export ()
94 (let ((batch-export t)
95 (files (directory-files org-website-folder t "\\.org$"))
98 (message "exporting: %s" file)
99 (with-current-buffer (find-file-noselect file)
101 (org-html-export-to-html)
102 (error (setq errors (append errors file))))))
103 (message "finished exporting. Experienced errors with:%s" (if errors (concat "\n - " (s-join "\n - " errors)) ""))))
106 We use a little shell hack to immediately call Emacs on the file
109 ":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
111 Then we can execute some Elisp. This requires the =htmlize= package, and
112 =ignore-headlines= from =ox-extra=.
113 #+begin_src emacs-lisp
116 (load "~/.emacs.d/.local/straight/repos/emacs-htmlize/htmlize.el" t t) ; system-dependant
119 (load "~/.emacs.d/.local/straight/repos/org-mode/contrib/lisp/ox-extra.el" t t)
121 (ox-extras-activate '(ignore-headlines))
124 org-html-style-default ""
126 org-html-htmlize-output-type 'css
127 org-html-doctype "html5"
128 org-html-html5-fancy t
129 org-html-validation-link nil
131 org-html-postamble-format
132 '(("en" "<p class=\"author\">Made with <a href=\"https://orgmode.org/worg/org-site-colophon.html\">🤎</a> by <a href=\"https://github.com/tecosaur/\" style=\"font-weight: bold; font-size: 0.9em; letter-spacing: 1px\">TEC</a></p>
133 <p xmlns:dct=\"http://purl.org/dc/terms/\" xmlns:cc=\"http://creativecommons.org/ns#\" class=\"license-text\" style=\"color: #aaa\">licensed under <a rel=\"license\" href=\"https://creativecommons.org/licenses/by-sa/4.0/\"><img class=\"inline\" src=\"/resources/img/external/cc-by-sa.svg\" title=\"CC-BY-SA 4.0\" alt=\"CC-BY-SA\"/></a></p>"))
134 make-backup-files nil
137 (let ((scss-files (directory-files-recursively default-directory "\\.scss$"))
138 (org-files (directory-files-recursively default-directory "\\.org$")))
139 (if (executable-find "sassc")
140 (dolist (scss-file scss-files)
142 (shell-command-to-string
143 (format "sassc %s %s"
144 scss-file (concat (file-name-sans-extension scss-file) ".css")))))
145 (message "\033[0;35m• %s%s\033[0m" (file-relative-name scss-file default-directory)
146 (if (string= "" sassc-out) "" (concat ":\033[31m\n" sassc-out)))))
147 (message "No sassc executable found"))
148 (dolist (org-file org-files)
149 (message "\033[0;34m• %s\033[90m" (file-relative-name org-file default-directory))
150 (with-current-buffer (find-file-literally org-file)
152 (progn (org-html-export-to-html)
153 (htmlize-file org-file (concat org-file ".html")))
154 (error (message " \033[0;31m%s\033[90m" (error-message-string err)))))))