Files
website-v2/core/asciidoc.py
daveoconnor b4a6ddd751 Added support for release notes asciidoc macros (#1082) (#1377)
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/
2024-11-08 13:31:32 -08:00

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