2

I have this basic org publishing project to test that code blocks evaluation is triggered by publishing in html (org-html-publish-to-html). While exporting through org-mode export dispatcher does evaluate code blocks automatically, publishing does not.

Here the content of the only file of the project, test.org:

#+NAME: ls
#+BEGIN_SRC sh :export results

echo $(ls)

#+END_src

#+RESULTS: ls

I publish the website running:

emacs --batch --no-init-file --load publish.el --funcall org-publish-all

with this publish.el:

(package-initialize)
;(require 'org)
(require 'ob-tangle)
(require 'ox-publish)
(require 'ox-latex)
(require 'ox-html)


(setq org-confirm-babel-evaluate nil) ; don't ask for confirmation before evaluating a code block
(setq org-export-babel-evaluate t)
(setq org-export-use-babel t)


(setq org-publish-project-alist
      `(("test"
         :recursive t
         :base-directory "."
         :base-extension "org"
         :publishing-directory "./public"
         :publishing-function org-html-publish-to-html
         :section-numbers nil
         )

        ))

(I also tried :results html and :results output with no more luck)

This is a toy test because I ran into the problem while building a website. I didn't see anywhere that publishing would not evaluate code, anyone has any info on that ?

It has been seen locally on my laptop as well as on a distant gitlab repo, the publishing process being ran on the distant git server.

GNU Emacs 24.5.1 / Org mode version 9.0.3 / Debian Jessie

1
  • My mistake, the header of the code block is actually: #+BEGIN_SRC sh :exports results (exports, with an 's') and it does not evaluate neither Commented Feb 3, 2018 at 23:36

1 Answer 1

2

Finally works, seems the trick was to add:

(org-babel-do-load-languages                                                                                                                                                                                                                 
 'org-babel-load-languages                                                                                                                                                                                                                   
 '((sh . t)))

in publish.el

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.