[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

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 easily publish a bunch of org files to a remote location. Here is the current
declaration of my projects, which will be detailed later: declaration of my projects, which will be detailed later:
#+NAME: org-publish-projects #+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-config-setup>>
<<org-proj-lang-setup>> <<org-proj-lang-setup>>
(setq org-publish-project-alist (setq org-publish-project-alist
`( `(<<org-proj-config-html>>
<<org-proj-config-html>>
<<org-proj-config-static>> <<org-proj-config-static>>
<<org-proj-config>> <<org-proj-config>>
<<org-proj-lang-html>> <<org-proj-lang-md>>
<<org-proj-lang-pdf>>
<<org-proj-lang-static>>
<<org-proj-lang>>)) <<org-proj-lang>>))
#+END_SRC #+END_SRC
@ -5526,113 +5523,48 @@ by individuals or by groups of individuals, unlike natural languages
which evolve and appear naturally from other languages. which evolve and appear naturally from other languages.
#+end_info #+end_info
My conlanging website is made out of three projects. As for the My conlanging website is made of only one project, exporting my org
previous project, lets declare the common values for these. files to GitHub-flavored Markdown. As for the previous project, lets
declare a common value.
#+NAME: org-proj-lang-setup #+NAME: org-proj-lang-setup
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defvar phundrak//projects-conlanging-target (defvar phundrak--projects-conlanging-common-root
"/rsync:Tilo:~/www/phundrak.com/conlang" "~/org/conlanging/docs/"
"Points to where exported files for langue.phundrak.com should be put.") "Points to the common root of my source and target for my
(defvar phundrak//projects-conlanging-source conlang.phundrak.com org project.")
"~/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.")
#+END_SRC #+END_SRC
The first component is the one generating the HTML files from the org files. The only component is the one generating the Markdown files from the
#+NAME: org-proj-lang-html org files.
#+NAME: org-proj-lang-md
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
("conlang-phundrak-com-html" ("conlang-phundrak-com-md"
:base-directory ,phundrak//projects-conlanging-source :base-directory ,phundrak--projects-conlanging-common-root
:base-extension "org" :base-extension "org"
:exclude ,(rx (* print) :exclude ,(rx (* print)
(or "CONTRIB" (or "CONTRIB"
"README" "README"
"header" "site-map"
"temp" "temp"
"private" "private"
"svg-ink") "svg-ink")
(* print)) (* print))
:publishing-directory ,phundrak//projects-conlanging-target :publishing-directory ,phundrak--projects-conlanging-common-root
:recursive ,phundrak//projects-conlanging-recursive :recursive t
:language ,phundrak//projects-conlanging-language :language "en"
:publishing-function org-html-publish-to-html :publishing-function org-gfm-publish-to-gfm
:headline-levels 5 :headline-levels 5
:auto-sitemap t :auto-sitemap nil
:auto-preamble t) :auto-preamble nil)
#+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)
#+END_SRC #+END_SRC
The project is then defined like so: The project is then defined like so:
#+NAME: org-proj-lang #+NAME: org-proj-lang
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
("conlang-phundrak-com" ("conlang-phundrak-com"
:components ("conlang-phundrak-com-org" :components ("conlang-phundrak-com-md"))
"conlang-phundrak-com-static"
"conlang-phundrak-com-pdf"))
#+END_SRC #+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 *** Org-ref and Bibtex configuration
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Org-mode-org-ref-1h586cd085j0 :CUSTOM_ID: Packages-Configuration-Org-mode-org-ref-1h586cd085j0