summaryrefslogtreecommitdiffstats
path: root/build.el
diff options
context:
space:
mode:
Diffstat (limited to 'build.el')
-rw-r--r--build.el81
1 files changed, 81 insertions, 0 deletions
diff --git a/build.el b/build.el
new file mode 100644
index 0000000..4fb9d06
--- /dev/null
+++ b/build.el
@@ -0,0 +1,81 @@
+(require 'ox-publish)
+(require 'ox-html)
+
+;; general settings
+(setq org-html-extension "xhtml")
+
+;; custom URIs
+(org-link-set-parameters "xmpp")
+(org-link-set-parameters "monero")
+
+;; html output customization
+(setq org-html-validation-link nil
+ org-html-head-include-scripts nil
+ org-html-head-include-default-style nil
+ org-html-head "<link rel=\"stylesheet\" type=\"text/css\"
+href=\"./assets/styles.css\"/>")
+
+;; exclude sections for certain backends
+(defun wk/exclude-backends (backend)
+ (setq org-export-exclude-tags
+ `(,(concat "noexport_" (symbol-name backend)) "noexport")))
+(add-hook 'org-export-before-parsing-functions #'wk/exclude-backends)
+
+;; customize the html exporter
+(defun wk/org-html--tags (tags info)
+ "Format TAGS into HTML.
+INFO is a plist containing export options."
+ (when tags
+ (format "<span class=\"tag\">%s</span>"
+ (mapconcat
+ (lambda (tag)
+ (if (string-prefix-p "noexport" tag)
+ ""
+ (format "<span class=\"%s\">%s</span>"
+ (concat (plist-get info :html-tag-class-prefix)
+ (org-html-fix-class-name tag))
+ tag)))
+ tags "&#xa0;"))))
+
+(defun wk/org-html-format-headline-function
+ (todo _todo-type priority text tags info)
+ "Default format function for a headline.
+See `org-html-format-headline-function' for details and the
+description of TODO, PRIORITY, TEXT, TAGS, and INFO arguments."
+ (let ((todo (org-html--todo todo info))
+ (priority (org-html--priority priority info))
+ (tags (wk/org-html--tags tags info)))
+ (concat todo (and todo " ")
+ priority (and priority " ")
+ text
+ (and tags "&#xa0;&#xa0;&#xa0;") tags)))
+
+(setq org-html-format-headline-function #'wk/org-html-format-headline-function)
+
+;; project definition
+(setq org-publish-project-alist
+ '(("http-content"
+ :base-directory "./content/"
+ :base-extension "org"
+ :publishing-directory "./public/http"
+ :recursive t
+ :publishing-function org-html-publish-to-html
+
+ :headline-levels 3
+ :with-author nil
+ :with-creator nil
+ :with-toc nil
+ :section-numbers nil
+ :time-stamp-file nil)
+ ("http-assets"
+ :base-directory "./content/assets"
+ :base-extension any
+ :exclude "\\.\\*.org"
+ :publishing-directory "./public/http/assets"
+ :recursive t
+ :publishing-function org-publish-attachment)))
+
+
+;; export all
+(org-publish-all t)
+(message "Build complete")