mirror of
https://github.com/boostorg/website-v2.git
synced 2026-01-19 04:42:17 +00:00
Related to ticket #1082, this adds support for asciidoc macros to emulate macros from qbk. Macro support is documented at https://github.com/cppalliance/asciidoctor-boost/
27 lines
688 B
Python
27 lines
688 B
Python
import subprocess
|
|
|
|
|
|
def convert_adoc_to_html(input):
|
|
"""
|
|
Converts an AsciiDoc file to HTML.
|
|
|
|
Note: This returns an html fragment, not the full <html> document with the
|
|
<head> and <body> tags.
|
|
|
|
The asciidoctor package is a Ruby gem, which is why we're using subprocess
|
|
to run the command.
|
|
https://docs.asciidoctor.org/asciidoctor/latest/
|
|
|
|
:param input: The contents of the AsciiDoc file
|
|
"""
|
|
result = subprocess.run(
|
|
["asciidoctor", "-r", "asciidoctor_boost", "-e", "-o", "-", "-"],
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
input=input,
|
|
)
|
|
|
|
# Get the output from the command
|
|
return result.stdout
|