work-site/work.el

93 lines
3 KiB
EmacsLisp
Raw Normal View History

;; 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 "<a href=\"https://orgmode.org/\">Org-mode</a>")
(src "<a href=\"https://git.marvid.fr/scolobb/work-site\">source</a>"))
(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 "<span class=\"updated\">"
(make-update-time lang)
"</span> <span class=\"poweredby\">"
(make-powered-by lang)
"</span>"))
;; Set up org-publish for my work site.
(let* ((work-base "~/Candies/Sites/work/")
(publishing-base (concat work-base "www/"))
(my-styles "<link rel=\"stylesheet\" type=\"text/css\" href=\"../content/css/default.css\" />")
(my-preamble "
<span class=\"myname\">Sergiu Ivanov</span>
<span class=\"logos\">
<a href=\"https://www.ibisc.univ-evry.fr/\"><img src=\"../content/imgs/ibisc.png\" alt=\"lab logo\" class=\"ibisclogo\" /></a>
<a href=\"https://www.univ-evry.fr/accueil.html\"><img src=\"../content/imgs/ueve.png\" alt=\"university logo\" class=\"uevelogo\" /></a>
</span>"))
(setq org-publish-project-alist
`(("work-site"
:components ("work-site-en" "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 ,my-styles
:html-preamble ,my-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 ,my-styles
:html-preamble ,my-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))))