2018-09-13 15:16:53 +02:00
|
|
|
;; 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>")
|
2018-09-13 22:18:55 +02:00
|
|
|
(src "<a href=\"https://git.marvid.fr/scolobb/work-site\">source</a>"))
|
2018-09-13 15:16:53 +02:00
|
|
|
(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>"))
|
|
|
|
|
2018-09-30 21:38:51 +02:00
|
|
|
;; Produce the <link> tag including the stylesheet relative to the
|
|
|
|
;; given root.
|
|
|
|
(defun make-styles (root)
|
|
|
|
(concat "<link rel=\"stylesheet\" type=\"text/css\" href=\"" root "content/css/default.css\" />"))
|
|
|
|
|
|
|
|
;; Produce the preamble with links relative to the given root.
|
|
|
|
(defun make-preamble (root)
|
|
|
|
(concat "
|
2018-09-13 15:16:53 +02:00
|
|
|
<span class=\"myname\">Sergiu Ivanov</span>
|
|
|
|
<span class=\"logos\">
|
2018-09-30 21:38:51 +02:00
|
|
|
<a href=\"https://www.ibisc.univ-evry.fr/\"><img src=\"" root "content/imgs/ibisc.png\" alt=\"lab logo\" class=\"ibisclogo\" /></a>
|
|
|
|
<a href=\"https://www.univ-evry.fr/accueil.html\"><img src=\"" root "content/imgs/ueve.png\" alt=\"university logo\" class=\"uevelogo\" /></a>
|
2018-09-13 15:16:53 +02:00
|
|
|
</span>"))
|
|
|
|
|
|
|
|
|
2018-09-30 21:38:51 +02:00
|
|
|
;; Set up org-publish for my work site.
|
|
|
|
(let* ((work-base "~/Candies/Sites/work/")
|
|
|
|
(publishing-base (concat work-base "www/")))
|
|
|
|
|
|
|
|
|
2018-09-13 15:16:53 +02:00
|
|
|
(setq org-publish-project-alist
|
|
|
|
`(("work-site"
|
2018-09-30 20:51:45 +02:00
|
|
|
:components ("work-site-en" "work-site-en-index" "work-site-fr" "work-site-content"))
|
2018-09-13 15:16:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
("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
|
2018-09-30 21:38:51 +02:00
|
|
|
:html-head-extra ,(make-styles "../")
|
|
|
|
:html-preamble ,(make-preamble "../")
|
2018-09-13 15:16:53 +02:00
|
|
|
:html-postamble ,(make-postamble 'en))
|
|
|
|
|
|
|
|
|
2018-09-30 20:51:45 +02:00
|
|
|
;; 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 "org"
|
|
|
|
:base-directory ,work-base
|
|
|
|
:exclude "work-notes.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
|
2018-09-30 21:38:51 +02:00
|
|
|
:html-head-extra ,(make-styles "")
|
|
|
|
:html-preamble ,(make-preamble "")
|
2018-09-30 20:51:45 +02:00
|
|
|
:html-postamble ,(make-postamble 'en))
|
|
|
|
|
|
|
|
|
2018-09-13 15:16:53 +02:00
|
|
|
("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
|
2018-09-30 21:38:51 +02:00
|
|
|
:html-head-extra ,(make-styles "../")
|
|
|
|
:html-preamble ,(make-preamble "../")
|
2018-09-13 15:16:53 +02:00
|
|
|
: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))))
|