119 lines
3.8 KiB
EmacsLisp
119 lines
3.8 KiB
EmacsLisp
;; 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>"))
|
|
|
|
;; 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 "
|
|
<span class=\"myname\">Sergiu Ivanov</span>
|
|
<span class=\"logos\">
|
|
<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>
|
|
</span>"))
|
|
|
|
|
|
;; 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 "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
|
|
: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))))
|