getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
58 stars 94 forks source link

Orgmode macros cause abort #391

Open roblem opened 3 years ago

roblem commented 3 years ago

Environment

Python Version: Python 3.8.8

Nikola Version: Nikola v8.1.3

Operating System: Fedora 34

Description:

Emacs Orgmode source files are failing to be rendered as html if they contain org macros. The following org file can be exported successfully (with the {{{x_variable}}} being replaced with the value First Blogpost!) if using standard orgmode export. Using this orgmode source:

#+BEGIN_COMMENT
.. title: Test macro
.. slug: test_macro
.. date: 2021-06-16 012:31:21 UTC-05:00
.. tags: test
.. link:
.. description:
.. type: text
#+END_COMMENT

#+MACRO: x_variable First Blogpost!

This is my {{{x_variable}}}

I get the error:

Undefined Org macro: x_variable; aborting

when using either nikola build or the manual nikola command:

emacs --batch -l ./init.el --eval '(nikola-html-export "~/Downloads/blog/blogpost.org" "~/Downloads/blog/blogpost.html")'

This was working awhile back.

punchagan commented 3 years ago

Have you updated emacs or org-mode meanwhile? What are the versions you are using currently, so I can try to reproduce?

roblem commented 3 years ago

It is possible things have updated as Fedora stays very close to current releases.

Emacs version: GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4) of 2021-06-13 Orgmode version: Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)

A completely new blog site/folder with

Build fails with this:

Scanning posts..........done!
.  render_listings:output/listings/index.html
.  copy_assets:output/assets/css/bootblog.css
.  copy_assets:output/assets/css/bootstrap.min.css
.  copy_assets:output/assets/css/theme.css
.  copy_assets:output/assets/js/bootstrap.min.js
.  copy_assets:output/assets/js/jquery.min.js
.  copy_assets:output/assets/js/popper.min.js
.  copy_assets:output/assets/css/baguetteBox.min.css
.  copy_assets:output/assets/css/html4css1.css
.  copy_assets:output/assets/css/ipython.min.css
.  copy_assets:output/assets/css/nikola_ipython.css
.  copy_assets:output/assets/css/nikola_rst.css
.  copy_assets:output/assets/css/rst.css
.  copy_assets:output/assets/css/rst_base.css
.  copy_assets:output/assets/js/baguetteBox.min.js
.  copy_assets:output/assets/js/fancydates.js
.  copy_assets:output/assets/js/fancydates.min.js
.  copy_assets:output/assets/js/gallery.js
.  copy_assets:output/assets/js/gallery.min.js
.  copy_assets:output/assets/js/html5.js
.  copy_assets:output/assets/js/html5shiv-printshiv.min.js
.  copy_assets:output/assets/js/justified-layout.min.js
.  copy_assets:output/assets/js/luxon.min.js
.  copy_assets:output/assets/xml/atom.xsl
.  copy_assets:output/assets/xml/rss.xsl
.  copy_assets:output/assets/css/code.css
.  render_sources:output/posts/test_macro/index.org
.  render_posts:timeline_changes
.  render_posts:cache/posts/test.html
Loading /usr/share/emacs/site-lisp/site-start.d/autoconf-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/cmake-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/desktop-entry-mode-init.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/mercurial-site-start.el (source)...
Loading /usr/share/emacs/site-lisp/site-start.d/rpmdev-init.el (source)...
Created img-url link.
Created file link.
Undefined Org macro: x_variable; aborting
TaskError - taskid:render_posts:cache/posts/test.html
PythonAction Error
Traceback (most recent call last):
  File "~/Downloads/blog/localhost/plugins/orgmode/orgmode.py", line 75, in compile
    subprocess.check_call(command)
  File "~/anaconda3/envs/python3/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['emacs', '--batch', '-l', '~/Downloads/blog/localhost/plugins/orgmode/init.el', '--eval', '(nikola-html-export "~/Downloads/blog/localhost/posts/test.org" "~/Downloads/blog/localhost/cache/posts/test.html")']' returned non-zero exit status 255.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/anaconda3/envs/python3/lib/python3.8/site-packages/doit/action.py", line 437, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "~/anaconda3/envs/python3/lib/python3.8/site-packages/nikola/post.py", line 728, in compile
    self.compile_html(
  File "~/Downloads/blog/localhost/plugins/orgmode/orgmode.py", line 94, in compile
    raise Exception('''Cannot compile {0} -- bad org-mode configuration (return code {1})
Exception: Cannot compile posts/test.org -- bad org-mode configuration (return code 255)
The command is emacs --batch -l ~/Downloads/blog/localhost/plugins/orgmode/init.el --eval '(nikola-html-export "~/Downloads/blog/localhost/posts/test.org" "~/Downloads/blog/localhost/cache/posts/test.html")'

If I delete {{{x_variable}}}, it builds without issue.

roblem commented 3 years ago

Just fired up a Ubuntu 20.04 VM, running python 3.8.10 and Nikola 8.1.3 with Emacs: Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) Orgmode: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)

and it builds fine with the macro.