coqdomain.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:coq-rst 作者: cpitclaudel 项目源码 文件源码
def simplify_source_code_blocks_for_latex(app, doctree, fromdocname): # pylint: disable=unused-argument
    """Simplify coqdoc and coqtop blocks.

    In HTML mode, this does nothing; in other formats, such as LaTeX, it
    replaces coqdoc and coqtop blocks by plain text sources, which will use
    pygments if available.  This prevents the LaTeX builder from getting
    confused.
    """

    is_html = app.builder.tags.has("html")
    for node in doctree.traverse(is_coqtop_or_coqdoc_block):
        if is_html:
            node.rawsource = '' # Prevent pygments from kicking in
        else:
            if 'coqtop-hidden' in node['classes']:
                node.parent.remove(node)
            else:
                node.replace_self(nodes.literal_block(node.rawsource, node.rawsource, language="Coq"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号