emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thoughts on the standardization of Org


From: Dr. Arne Babenhauserheide
Subject: Re: Thoughts on the standardization of Org
Date: Sun, 01 Nov 2020 11:25:47 +0100
User-agent: mu4e 1.4.13; emacs 27.1

> see discussion on Mauro's thread about
> the fact that it is probably just easier to use Emacs directly if you
> need to export
> to a certain format in a specific way. It is free software after all.

I would like to add, that this is pretty easy to do, and also to make
independent of the users emacs environment. Here is an example that
uses the whole orgmode-babel-latex-html machinery to create derived
documents from source-of-truth org-mode files which get exported to a
book:
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/Makefile.am?rev=b8e3899c6d8b#L121


chargen.tex: chargen.org $(ewstables_SOURCES) kasten-alter-groesse-gewicht.org 
ews30setup.el
        echo yes > $$(tty); Xvfb :3 -screen 0 1024x768x16 & time DISPLAY=:3 
HOME=@abs_top_srcdir@ @EMACS@ -l "@abs_top_srcdir@/ews30setup.el" --eval '(setq 
vc-follow-symlinks nil)' --eval '(setq org-id-locations-file 
"@abs_top_builddir@/.org-id-locations")' "$<" -e org-latex-export-to-latex -e 
kill-emacs  < $$(tty) >> build.log && rm -f 
"@abs_top_builddir@/.org-id-locations"

Note how this sets the HOME to the sourcedir (so a project-specific
.emacs.d setup is used) and loads ews30setup.el at startup for
additional customization. Also note the call to Xvfb which avoids
showing a graphical Emacs during build.


This uses an org-mode file that pulls data from tables in other org-mode
files by setting variables for code based on autotools-included
datafiles. Here’s an example of pulling the tables into variables:
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=b8e3899c6d8b#L153

#+begin_src scheme :exports none :results output raw :prologue "(import (srfi 
srfi-1)(ice-9 match)(ice-9 receive))(set! *random-state*  
(random-state-from-platform))\n" :tangle chargen.scm :noweb yes :var 
kernantriebe=tabelle-kernantriebe :var hautfarbe=tabelle-hautfarbe :var 
haarfarbe=tabelle-haarfarbe :var augenfarbe=tabelle-augenfarbe :var 
darstellung1=tabelle-darstellung1 :var darstellung2=tabelle-darstellung2 :var 
kleidung_oben_maenner=tabelle-kleidung-fantasy-oben-maenner  :var 
kleidung_unten_maenner=tabelle-kleidung-fantasy-unten-maenner :var 
kleidung_oben_frauen=tabelle-kleidung-fantasy-oben-frauen  :var 
kleidung_unten_frauen=tabelle-kleidung-fantasy-unten-frauen :var 
kleidung_oben_frauen=tabelle-kleidung-fantasy-oben-frauen  :var 
kleidung_unten_frauen=tabelle-kleidung-fantasy-unten-frauen :var 
namen=tabelle-namen-fantasy-jetzt :var sex=tabelle-sexualitaet :var 
stichwort=tabelle-stichwort-fantasy
  (let ()
    {{{chargen-setup}}}
    {{{chargen-generic}}}
    {{{chargen-colors}}}
    {{{chargen-specifics-fantasy}}}
    {{{chargen-print-char}}}
    (chargen-print-char)
  )
#+end_src


Note the {{{…}}} blocks. Those use literate programming to include
blocks defined below, with customized separators:
chargen-setup block: 
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=b8e3899c6d8b#L360
customization of separators: 
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=b8e3899c6d8b#L638
# Local Variables:
# org-confirm-babel-evaluate: nil
# org-export-allow-bind-keywords: t
# org-babel-noweb-wrap-start: "{{{"
# org-babel-noweb-wrap-end: "}}}"
# End:


Here’s how it pulls tables:
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/chargen.org.in?rev=b8e3899c6d8b#L578
@tabelle_aussehen@


And this is an example of the datafiles that are used as source-of-truth
and also directly inluded in the main book as tables:
https://hg.sr.ht/~arnebab/ews/browse/Hauptdokument/ews30/tabelle-aussehen.org?rev=b8e3899c6d8b#L578

#+tblname: tabelle-hautfarbe
|      | -5     | direkt      | 6              |
|------+--------+-------------+----------------|
|   -3 | blass  | rosig       | sommersprossig |
|   -1 | grau   | gelblich    | elfenbein      |
|    2 | kupfer | rotbraun    | bronze         |
|    4 | oliv   | dunkelbraun | schwarz        |
| -5/6 | albino | -           | fleckig        |


All this machinery can be invoked without ever seeing Emacs.


So yes, the Emacs implementation is the source of truth, and yes, this
can be used without requiring people to operate Emacs by simply using
Emacs as utility with project-specific setup — just as you would do it
with a compiler.


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]