coqdomain.py 文件源码

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

项目:coq-rst 作者: cpitclaudel 项目源码 文件源码
def GrammarProductionRole(typ, rawtext, text, lineno, inliner, options={}, content=[]):
    """An inline role to declare grammar productions that are not in fact included
    in a `productionlist` directive.

    Useful to informally introduce a production, as part of running text
    """
    #pylint: disable=dangerous-default-value, unused-argument
    env = inliner.document.settings.env
    targetid = 'grammar-token-{}'.format(text)
    target = nodes.target('', '', ids=[targetid])
    inliner.document.note_explicit_target(target)
    code = nodes.literal(rawtext, text, role=typ.lower())
    node = nodes.inline(rawtext, '', target, code, classes=['inline-grammar-production'])
    set_role_source_info(inliner, lineno, node)
    env.domaindata['std']['objects']['token', text] = env.docname, targetid
    return [node], []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号