getnikola / plugins

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

[orgmode] plugin seems to fail when using BEGIN_SRC block #306

Closed Binary-Eater closed 5 years ago

Binary-Eater commented 5 years ago

Here is the output I am getting when trying to run nikola auto.

Scanning posts......done!
.  render_posts:cache/pages/instructor-manuals/pl.html
Created img-url link.
Wrong type argument: char-or-string-p, nil
TaskError - taskid:render_posts:cache/pages/instructor-manuals/pl.html
PythonAction Error
Traceback (most recent call last):
  File "/home/binary-eater/Documents/cs296-25-work/staff-manual/plugins/orgmode/orgmode.py", line 74, in compile
    subprocess.check_call(command)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['emacs', '--batch', '-l', '/home/binary-eater/Documents/cs296-25-work/staff-manual/plugins/orgmode/init.el', '--eval', '(nikola-html-export "/home/binary-eater/Documents/cs296-25-work/staff-manual/pages/instructor-manuals/pl.org" "/home/binary-eater/Documents/cs296-25-work/staff-manual/cache/pages/instructor-manuals/pl.html")']' returned non-zero exit status 255.

Additional trace:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/doit/action.py", line 424, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/usr/lib/python3.7/site-packages/nikola/post.py", line 645, in compile
    lang)
  File "/home/binary-eater/Documents/cs296-25-work/staff-manual/plugins/orgmode/orgmode.py", line 93, in compile
    raise Exception('Cannot compile {0} -- bad org-mode configuration (return code {1})'.format(source, e.returncode))
Exception: Cannot compile pages/instructor-manuals/pl.org -- bad org-mode configuration (return code 255)

Org file that produced the error above.

#+BEGIN_COMMENT
.. title: Setup Instructions
.. slug: docker
.. date: 2019-02-02 13:49:32 UTC-06:00
.. tags: 
.. category: 
.. link: 
.. description: Setting Up the Instance
.. type: text

#+END_COMMENT

* Setting up Docker locally

For Arch Linux users, installing =docker= takes only one command.

#+BEGIN_SRC
sudo pacman -S docker
#+END_SRC

Using emacs version 26.2 and tried using 25.1. org version 9.2.3 used.

Kwpolska commented 5 years ago

I don’t use orgmode, but a quick Google search suggests you may need to specify a language for that source block.

Binary-Eater commented 5 years ago

@Kwpolska noticed that too and thanks for the update.

If I specify the language, I can compile my org file but run into this error in the html render.

zsh:1: command not found: pygmentize

Also, I was hoping not to need to specify a language for blocks that would have things like directory structures. The above snippet isn't my actual org file I am writing but one that reproduces the error.

Kwpolska commented 5 years ago
zsh:1: command not found: pygmentize

Make sure pygmentize is available on $PATH. It comes from the pygments pip package.

Kwpolska commented 5 years ago

Also, I was hoping not to need to specify a language for blocks that would have things like directory structures. The above snippet isn't my actual org file I am writing but one that reproduces the error.

Pygments supports a text language, but I don’t know if org-mode doesn’t do any filtering before the language name reaches Pygments.

Binary-Eater commented 5 years ago

@Kwpolska you are right. The language specifier is mandatory.

Mandatory for live code blocks. It is the identifier of the source code language in the block. See Languages, for identifiers of supported languages.

https://orgmode.org/manual/Structure-of-code-blocks.html#Structure-of-code-blocks

New to org myself. Would be nice to see if the org-mode plugin can throw a nicer exception for this error.

Binary-Eater commented 5 years ago
which pygmentize          
/usr/bin/pygmentize

Installed pygmentize as an Arch package and /usr/bin should be referable?

Binary-Eater commented 5 years ago

Just tested on another setup though and seems to be working fine with pygmentize. Going to close this issue since this seems to be more of an environment setup related issue. Thanks again @Kwpolska