[Emacs] Greatly simplify org conlang project

It's now a much simpler process to publish since I use Vuepress.
This commit is contained in:
Lucien Cartier-Tilet 2023-03-10 15:25:19 +01:00
parent d9f20bc035
commit bc03b083ef
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 23 additions and 91 deletions

View File

@ -5433,17 +5433,14 @@ Another great features of Org-mode is the Org projects that allow the user to
easily publish a bunch of org files to a remote location. Here is the current
declaration of my projects, which will be detailed later:
#+NAME: org-publish-projects
#+BEGIN_SRC emacs-lisp :noweb yes
#+BEGIN_SRC emacs-lisp :noweb yes :noweb-prefix no
<<org-proj-config-setup>>
<<org-proj-lang-setup>>
(setq org-publish-project-alist
`(
<<org-proj-config-html>>
`(<<org-proj-config-html>>
<<org-proj-config-static>>
<<org-proj-config>>
<<org-proj-lang-html>>
<<org-proj-lang-pdf>>
<<org-proj-lang-static>>
<<org-proj-lang-md>>
<<org-proj-lang>>))
#+END_SRC
@ -5526,113 +5523,48 @@ by individuals or by groups of individuals, unlike natural languages
which evolve and appear naturally from other languages.
#+end_info
My conlanging website is made out of three projects. As for the
previous project, lets declare the common values for these.
My conlanging website is made of only one project, exporting my org
files to GitHub-flavored Markdown. As for the previous project, lets
declare a common value.
#+NAME: org-proj-lang-setup
#+BEGIN_SRC emacs-lisp
(defvar phundrak//projects-conlanging-target
"/rsync:Tilo:~/www/phundrak.com/conlang"
"Points to where exported files for langue.phundrak.com should be put.")
(defvar phundrak//projects-conlanging-source
"~/Documents/conlanging/content/"
"Points to where the sources for langue.phundrak.com are.")
(defvar phundrak//projects-conlanging-language
"en"
"Language of langue.phundrak.com.")
(defvar phundrak//projects-conlanging-recursive
t
"Defines whether subdirectories should be parsed for langue.phundrak.com.")
(defvar phundrak--projects-conlanging-common-root
"~/org/conlanging/docs/"
"Points to the common root of my source and target for my
conlang.phundrak.com org project.")
#+END_SRC
The first component is the one generating the HTML files from the org files.
#+NAME: org-proj-lang-html
The only component is the one generating the Markdown files from the
org files.
#+NAME: org-proj-lang-md
#+BEGIN_SRC emacs-lisp
("conlang-phundrak-com-html"
:base-directory ,phundrak//projects-conlanging-source
("conlang-phundrak-com-md"
:base-directory ,phundrak--projects-conlanging-common-root
:base-extension "org"
:exclude ,(rx (* print)
(or "CONTRIB"
"README"
"header"
"site-map"
"temp"
"private"
"svg-ink")
(* print))
:publishing-directory ,phundrak//projects-conlanging-target
:recursive ,phundrak//projects-conlanging-recursive
:language ,phundrak//projects-conlanging-language
:publishing-function org-html-publish-to-html
:publishing-directory ,phundrak--projects-conlanging-common-root
:recursive t
:language "en"
:publishing-function org-gfm-publish-to-gfm
:headline-levels 5
:auto-sitemap t
:auto-preamble t)
#+END_SRC
We also have the component for the LaTeX and PDF part of the website:
#+NAME: org-proj-lang-pdf
#+BEGIN_SRC emacs-lisp
("conlang-phundrak-com-pdf"
:base-directory ,phundrak//projects-conlanging-source
:base-extension "org"
:exclude ,(rx (* print)
(or "CONTRIB"
"README"
"header"
"temp"
"index"
"sitemap"
"private"
"svg-ink")
(* print))
:publishing-directory ,phundrak//projects-conlanging-target
:recursive ,phundrak//projects-conlanging-recursive
:language ,phundrak//projects-conlanging-language
:publishing-function org-latex-publish-to-pdf
:headline-levels 5
:auto-preamble t)
#+END_SRC
And lastly, we have the component for all the static files needed to run the
website:
#+NAME: org-proj-lang-static
#+BEGIN_SRC emacs-lisp
("conlang-phundrak-com-static"
:base-directory ,phundrak//projects-conlanging-source
:base-extension "png\\|jpg\\|gif\\|webp\\|svg\\|jpeg\\|ttf\\|woff\\|txt\\|epub"
:publishing-directory ,phundrak//projects-conlanging-target
:recursive ,phundrak//projects-conlanging-recursive
:language ,phundrak//projects-conlanging-language
:publishing-function org-publish-attachment)
:auto-sitemap nil
:auto-preamble nil)
#+END_SRC
The project is then defined like so:
#+NAME: org-proj-lang
#+BEGIN_SRC emacs-lisp
("conlang-phundrak-com"
:components ("conlang-phundrak-com-org"
"conlang-phundrak-com-static"
"conlang-phundrak-com-pdf"))
:components ("conlang-phundrak-com-md"))
#+END_SRC
This project leaves a lot of junk files here and there. This is why I
have this command to remove them easily.
#+begin_src emacs-lisp
(defun phundrak/clean-conlanging-directory ()
"Clean my conlanging directory from junk files."
(interactive)
(let ((files (directory-files-recursively phundrak//projects-conlanging-source
(rx (* print)
"."
(or "glo"
"html"
"ist"
"tex"
"pdf")))))
(mapc (lambda (file) (delete-file file))
(cl-remove-if (lambda (str)
(string-match-p (regexp-quote "headers.tex") str))
files))))
#+end_src
*** Org-ref and Bibtex configuration
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Org-mode-org-ref-1h586cd085j0