emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Coloured source code examples in --batch exports?
@ 2019-06-13 15:20 Stig Brautaset
  2019-06-13 20:16 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Stig Brautaset @ 2019-06-13 15:20 UTC (permalink / raw)
  To: emacs-orgmode

Consider a file =foo.org= with the following content:

#+begin_src org :tangle foo.org
,#+begin_src emacs-lisp
  (defun foo (a b c)
    "A metasyntactic function that doesn't do much."
    (interactive)
    (message "foo"))
,#+end_src
#+end_src

I can export that to HTML and get a nicely colourized export like so:

#+begin_src sh :results output verbatim
/Applications/Emacs.app/Contents/MacOS/Emacs --file foo.org --eval '(progn (package-initialize) (org-html-export-to-html nil nil nil t) (kill-emacs))'
cat foo.html
#+end_src

#+RESULTS:
: <div class="org-src-container">
: <pre class="src src-emacs-lisp">(<span style="font-weight: bold;">defun</span> <span style="font-weight: bold;">foo</span> (a b c)
:   <span style="font-style: italic;">"A metasyntactic function that doesn't do much."</span>
:   (<span style="font-weight: bold;">interactive</span>)
:   (message <span style="font-style: italic;">"foo"</span>))
: </pre>
: </div>

However, I can't run it like that because I'm trying to run it headless
on CirleCI, where neither DISPLAY nor TERM environment variables are
set. (Yes, I'm trying to automate my blog publishing.)

Adding a ~--batch~ flag to the command makes the command run on
CircleCI, but I get a less colourful (and less pleasing) result. The
markup appears to only use /italic/ and *bold* styles now.

#+begin_src sh :results output verbatim
/Applications/Emacs.app/Contents/MacOS/Emacs --batch --file foo.org --eval '(progn (package-initialize) (org-html-export-to-html nil nil nil t) (kill-emacs))'
cat foo.html
#+end_src

#+RESULTS:
: <div class="org-src-container">
: <pre class="src src-emacs-lisp">(<span style="font-weight: bold;">defun</span> <span style="font-weight: bold;">foo</span> (a b c)
:   <span style="font-style: italic;">"A metasyntactic function that doesn't do much."</span>
:   (<span style="font-weight: bold;">interactive</span>)
:   (message <span style="font-style: italic;">"foo"</span>))
: </pre>
: </div>

Is there a way I can get the nicely coloured output while exporting in
~--batch~ mode?

Stig


PS: In reality I'm using Org's publishing setup, but it was easier to
create a minimal example using export than an ECM that involves having
to configure ~org-publish-project-alist~...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-13 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 15:20 Coloured source code examples in --batch exports? Stig Brautaset
2019-06-13 20:16 ` Nick Dokos
2019-06-13 21:34   ` Stig Brautaset

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).