Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for a ASCIIDOC_OPTIONS option
  • Loading branch information
Roberto Alsina committed Aug 21, 2018
1 parent cb8958f commit 972523f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion v8/asciidoc/asciidoc.py
Expand Up @@ -32,6 +32,7 @@

import io
import os
import shlex
import subprocess

from nikola.plugin_categories import PageCompiler
Expand All @@ -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})

Expand Down

0 comments on commit 972523f

Please sign in to comment.