Commit adba298a2383

Vincent Demeester <vincent@sbr.pm>
2020-03-27 16:27:16
Update docs/ folder and Makefile…
… to publish stuff on `www` 🎯 Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 9115eca
docs/.setupfile.org
@@ -0,0 +1,4 @@
+#+AUTHOR: Vincent Demeester
+#+KEYWORDS: configuration
+#+OPTIONS: toc:t
+#+EXCLUDE_TAGS: noexport
docs/emacs.org → docs/emacs.old.org
@@ -1,5 +1,5 @@
-#+SETUPFILE: ../_setup.org
 #+TITLE: Vincent Demeester's .emacs.d
+#+SETUPFILE: ./.setupfile.org
 
 * Overview
 :PROPERTIES:
docs/mails.org
@@ -1,6 +1,6 @@
-#+SETUPFILE: ../_setup.org
 #+TITLE: My email setup
 #+SUBTITLE: A very opiniated mail setup
+#+SETUPFILE: ./.setupfile.org
 
 #+BEGIN_abstract
 This article presents my opinionated email setup, client side. By opinionated I mean that
.gitignore
@@ -2,4 +2,5 @@
 result
 home.nix
 *.retry
-assets/machines.nix
\ No newline at end of file
+assets/machines.nix
+docs/index.org
\ No newline at end of file
Makefile
@@ -1,29 +1,49 @@
+# Makefile for home
+
+.PHONY: all build build-www clean publish pull switch update
+
+EMACS =
+ifndef EMACS
+EMACS = "emacs"
+endif
+
+PUBLISH_FOLDER =
+ifndef PUBLISH_FOLDER
+PUBLISH_FOLDER=~/desktop/sites/beta.sbr.pm
+endif
+
 all: build
 
-.PHONY: update
 update:
 	nix-channel --update
 
-.PHONY: pull
 pull:
 	(cd overlays/emacs-overlay && git pull --rebase)
 
-.PHONY: assets
 assets:
 	cp -Rv ~/sync/nixos/machines.nix assets/
 
-.PHONY: build
 build: assets
 	home-manager build
 
-.PHONY: switch
 switch: assets
 	home-manager switch
 
-.PHONY: clean
 clean:
 	unlink result
 
-.PHONY: publish
-publish:
-	cp *.org ~/desktop/org/technical/configurations/
+clean-www:
+	@rm -rvf *.elc
+	@rm -rv ~/.org-timestamps/*
+
+build-www: ${HOME}/src/www/publish-common.el publish.el
+	@echo "Publishing... with current Emacs configurations."
+	${EMACS} --batch --directory ${HOME}/.emacs.d/lisp/ \
+		--load ${HOME}/src/www/publish-common.el --load publish.el \
+		--funcall org-publish-all
+
+${HOME}/src/www/Makefile: ${HOME}/src/www/
+${HOME}/src/www/publish-common.el: ${HOME}/src/www/
+
+${HOME}/src/www/:
+	test -d ${HOME}/src/www || git clone git@git.sr.ht:~vdemeester/www.git ${HOME}/src/www/
publish.el
@@ -0,0 +1,52 @@
+;;; publish.el --- Publish home project -*- lexical-binding: t; -*-
+;; Author: Vincent Demeester <vincent@sbr.pm>
+
+;;; Commentary:
+;; This script will convert the org-mode files in this directory into
+;; html.
+
+;;; Code:
+(require 'package)
+(require 'publish-common)
+
+;; OrgPublishProjects
+(setq org-publish-project-alist
+      `(("configurations"
+         :base-directory "docs"
+         :base-extension "org"
+         :recursive t
+         :publishing-function org-html-publish-to-html
+         :publishing-directory "../www/public/configurations"
+         :exclude ,(regexp-opt '("README.org" "draft"))
+         :auto-sitemap t
+         :with-footnotes t
+         :with-toc t
+         :with-drawers t
+         :sitemap-filename "index.org"
+         :sitemap-title "Configurations"
+         :sitemap-style tree
+         :sitemap-sort-files anti-chronologically
+         :sitemap-format-entry sbr/org-sitemap-format-entry
+         :sitemap-function sbr/org-publish-sitemap
+         :html-head-include-scripts nil
+         :html-head-include-default-style nil
+         :html-head ,sbr-website-html-head
+         :html-preamble sbr-website-html-preamble
+         :html-postamble ,sbr-website-html-postamble)
+        ("images"
+         :base-directory "docs/images"
+         :base-extension ,site-attachments
+         :publishing-directory "../www/public/images"
+         :publishing-function org-publish-attachment
+         :recursive t)
+        ("assets"
+         :base-directory "docs/assets"
+         :base-extension ,site-attachments
+         :publishing-directory "../www/public/assets"
+         :publishing-function org-publish-attachment
+         :recursive t)
+        ("all" :components ("configurations" "images" "assets"))))
+;; -OrgPublishProjects
+
+(provide 'publish)
+;;; publish.el ends here