;; work.el ;; ;; The file setting up Org-mode to publish my work page. ;; ;; This file should be evaluated from within Emacs using the ;; 'eval-buffer' command. ;; Produce the string about the update date and time in French if lang ;; is 'fr and in English if lang is 'en or anything else. (defun make-update-time (lang) (let ((date (format-time-string "%Y-%m-%d")) (time (format-time-string "%H:%M"))) (cond ((eq lang 'en) (concat "Updated on " date " at " time ".")) ((eq lang 'fr) (concat "Mis à jour le " date " à " time ".")) (t (concat "Updated on " date " at " time "."))))) ;; Produce the string Powered by Org-mode in the appropriate language. (defun make-powered-by (lang) (let ((orgmode "Org-mode") (src "source")) (cond ((eq lang 'fr) (concat "Propulsé par " orgmode " (" src ").")) (t (concat "Powered by " orgmode " (" src ")."))))) ;; Produce the postamble in the given language (same convention as for ;; make-update-time). (defun make-postamble (lang) (concat "" (make-update-time lang) " " (make-powered-by lang) "")) ;; Produce the tag including the stylesheet relative to the ;; given root. (defun make-styles (root) (concat "")) ;; Produce the preamble with links relative to the given root. (defun make-preamble (root) (concat " Sergiu Ivanov \"lab \"university ")) ;; Set up org-publish for my work site. (let* ((work-base "~/Candies/Sites/work/") (publishing-base (concat work-base "www/"))) (setq org-publish-project-alist `(("work-site" :components ("work-site-en" "work-site-en-index" "work-site-fr" "work-site-content")) ("work-site-en" :base-extension "org" :base-directory ,(concat work-base "en/") :publishing-directory ,(concat publishing-base "en/") :publishing-function org-html-publish-to-html :section-numbers nil :with-toc nil :with-latex t :html-head-include-default-style nil :html-head-include-scripts nil :html-head-extra ,(make-styles "../") :html-preamble ,(make-preamble "../") :html-postamble ,(make-postamble 'en)) ;; We are going to need an index.html in the root directory. ;; We'll have a separate subproject for that file. ("work-site-en-index" :base-extension "" :base-directory ,work-base :include ("index.org") :publishing-directory ,publishing-base :publishing-function org-html-publish-to-html :section-numbers nil :with-toc nil :with-latex t :html-head-include-default-style nil :html-head-include-scripts nil :html-head-extra ,(make-styles "") :html-preamble ,(make-preamble "") :html-postamble ,(make-postamble 'en)) ("work-site-fr" :base-extension "org" :base-directory ,(concat work-base "fr/") :publishing-directory ,(concat publishing-base "fr/") :publishing-function org-html-publish-to-html :section-numbers nil :with-toc nil :with-latex t :html-head-include-default-style nil :html-head-include-scripts nil :html-head-extra ,(make-styles "../") :html-preamble ,(make-preamble "../") :html-postamble ,(make-postamble 'fr)) ("work-site-content" :base-extension any :base-directory ,(concat work-base "content/") :publishing-directory ,(concat publishing-base "content/") :publishing-function org-publish-attachment :recursive t))))