getpelican / pelican-plugins

Collection of plugins for the Pelican static site generator
Other
1.39k stars 856 forks source link

[asciidoc_reader] Custom AsciiDoc command #1369

Open arokettu opened 1 year ago

arokettu commented 1 year ago

Whitelisting possible commands prevents use of locally installed parsers like bin/asciidoc or bundle exec asciidoctor

avaris commented 1 year ago

Not necessarily. You just need asciidoc or asciidoctor in your PATH. It can point to your local install or a shell wrapper script.

Or a bit hacky but you can even do:

from pelican_plugins import asciidoc_reader  # adjust import accordingly
ASCIIDOC_CMD = "your command here"
asciidoc_reader.ALLOWED_CMDS.append(ASCIIDOC_CMD)

# ...
PLUGINS = [asciidoc_reader, ...]
arokettu commented 1 year ago

Yes, it works with bundle exec pelican in my case but the limitation seems arbitrary. I would understand it if there was some logic that depended on the tool being used but I see none

avaris commented 1 year ago

I could agree. I'm happy to review a PR if you want to submit one :).