【问题标题】:How to use AsciiDoc with Python?如何在 Python 中使用 AsciiDoc?
【发布时间】:2018-04-07 20:56:35
【问题描述】:

最初的 AsciiDoc 处理器是用 python 编写的,但 AsciiDoc 演变为用 Ruby 编写的 Asciidoctor。

在搜索如何处理现代 AsciiDoc(Asciidoctor 方言)时,我只看到一篇文章说有一个旧项目将 AsciiDoc 移植到 Python 3 (https://github.com/asciidoc/asciidoc/issues/83)。

但由于 AsciiDoc 起源于 Python,因此很难通过 google 找到任何有用的东西。

那么,目前在 Python 程序中处理 AsciiDoc 的最佳方式是什么?调用 Ruby 版本或命令行处理器?

【问题讨论】:

    标签: python asciidoc asciidoctor


    【解决方案1】:

    您可以继续使用 Python3:您可以在 www.asciidoc3.orggitlab.com/asciidoc3/asciidoc3 找到全新的 Python3 端口 AsciiDoc3。

    170 个 AsciiDoc 测试用例全部通过!

    【讨论】:

    • 酷而有趣。我认为这是旧 python2 asciidoc 的一个端口,而不是基于 ruby​​ 的 aaciidoctor?
    • 是的,AsciiDoc3 是“旧的 python2”asciidoc 到 100% 纯 Python3 的端口 - 与 asciidoctor 无关......
    • 它是如何工作的?网站不包含任何有意义的关于实际使用 Python 中的这些东西(不是通过运行可执行文件)
    • 要通过另一个 (python) 程序使用 asciidoc3 或 a2x3,只需输入类似这样的内容(或类似的内容 - 导入模块子进程):... p = subprocess.Popen(asciidoc3, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, bufsize=-1) output = p.communicate(...) ...
    • @TheGodfather 只是偶然发现了这个。 Asciidoc-py3 提供了一个 API 模块:github.com/asciidoc/asciidoc-py3/blob/master/asciidocapi.py。据说这也应该在 asciidoc3 中,但我在 repo 中没有看到它。
    猜你喜欢
    • 2020-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多