Skip to content
Permalink
Browse files
Add support for a ASCIIDOC_OPTIONS option
  • Loading branch information
Roberto Alsina committed Aug 21, 2018
1 parent cb8958f commit 972523f8b71d5ec881413d976d5f23ddf2e70c0e
Showing with 4 additions and 1 deletion.
  1. +4 −1 v8/asciidoc/asciidoc.py
@@ -32,6 +32,7 @@

import io
import os
import shlex
import subprocess

from nikola.plugin_categories import PageCompiler
@@ -52,12 +53,14 @@ class CompileAsciiDoc(PageCompiler):
def compile_string(self, data, source_path=None, is_two_file=True, post=None, lang=None):
"""Compile asciidoc into HTML strings."""
binary = self.site.config.get('ASCIIDOC_BINARY', 'asciidoc')
options = self.site.config.get('ASCIIDOC_OPTIONS', '')
options = shlex.split(options)
if not is_two_file:
m_data, data = self.split_metadata(data, post, lang)

from nikola import shortcodes as sc
new_data, shortcodes = sc.extract_shortcodes(data)
p = subprocess.Popen((binary, '-b', 'html5', '-s', '-'), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p = subprocess.Popen([binary, '-b', 'html5', '-s', '-'] + options, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
output, err = p.communicate(input=new_data.encode('utf8'))
output, shortcode_deps = self.site.apply_shortcodes_uuid(output, shortcodes, filename=source_path, extra_context={'post': post})

0 comments on commit 972523f

Please sign in to comment.