website/make.el

81 lines
2.4 KiB
EmacsLisp
Raw Normal View History

2021-02-25 19:56:21 +01:00
;;; Package -- make.el
;;; Commentary:
;;;
;;; Code:
2021-03-07 14:36:26 +01:00
(load-file "./ox-thtml.el")
;; (load-file "./htmlize.el")
2021-02-25 19:56:21 +01:00
(require 'org)
(require 'ox)
(require 'ox-html)
2021-02-25 19:56:21 +01:00
(dolist (d '("public_html"))
(unless (file-exists-p d)
(make-directory d)))
;; https://alhassy.github.io/AlBasmala.html#Floating-TOC
(advice-add 'org-html--translate :before-until 'display-toc-as-toc)
(defun display-toc-as-toc (phrase info)
(when (equal phrase "Table of Contents")
"<a>
TOC
</a>"))
;; DOES NOT WORK https://github.com/alphapapa/unpackaged.el#export-to-html-with-useful-anchors
(setq org-export-with-sub-superscripts '{}
org-export-headline-levels 6
; emacs-htmlize does not work when Emacs is ran in =script= mode unfortunately
;; org-html-html5-fancy t
;; org-html-htmlize-output-type 'inline-css
)
2021-03-07 14:36:26 +01:00
2021-02-25 19:56:21 +01:00
(defvar org-publish-project-alist)
(setq org-publish-project-alist
`(("blog-org"
:base-directory ,(expand-file-name "blog/")
:base-extension "org"
:publishing-directory ,(expand-file-name "public_html/")
:recursive t
:section-numbers nil
:with-toc nil
:with-date nil
:html-template ,(templated-html-load-template "templates/blog.html")
:publishing-function org-html-publish-to-templated-html
;; :htmlized-source t
:headline-levels 5
2021-03-07 14:36:26 +01:00
:exclude "^\\(index.org\\|*.inc\\)"
:auto-preamble t
:auto-sitemap t
:sitemap-folders ignore
:sitemap-style list
:sitemap-title "Magic_RB's blog"
2021-03-07 14:36:26 +01:00
:sitemap-filename "sitemap.inc"
:sitemap-sort-files anti-chronologically)
2021-02-25 19:56:21 +01:00
("blog-assets"
:base-directory ,(expand-file-name "assets/")
:publishing-directory ,(expand-file-name "public_html/")
:recursive t
:base-extension "\\(ttf\\|jpg\\|gif\\|png\\|css\\|js\\|el\\|nb\\|ipynb\\|pdf\\|xml\\)"
2021-02-25 19:56:21 +01:00
:publishing-function org-publish-attachment)
2021-03-07 14:36:26 +01:00
("homepage"
:base-directory ,(expand-file-name "./blog")
:root-directory ,(expand-file-name "./")
:recursive t
:base-extension "org"
:include ("index.org")
:exclude ,(regexp-opt '("blog" "assets" "org-thtml"))
:publishing-directory ,(expand-file-name "public_html/")
:section-numbers nil
:with-toc nil
:with-date nil
:html-template ,(templated-html-load-template "templates/index.html")
:publishing-function org-html-publish-to-templated-html)
2021-02-25 19:56:21 +01:00
("blog"
2021-03-07 14:36:26 +01:00
:components ("blog-org" "blog-assets" "homepage"))))
2021-02-25 19:56:21 +01:00
(org-publish "blog" t)
(provide 'make)
;;; make.el ends here