rst.py 文件源码

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

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def parse_rst_node(node, nodes, names, seen):
    # TODO add extensibility, to handle custom rst include tags...
    if node in seen:
        return
    seen.append(node)
    code = node.read()
    re_rst = re.compile(r'^\s*.. ((?P<subst>\|\S+\|) )?(?P<type>include|image|figure):: (?P<file>.*)$', re.M)
    for match in re_rst.finditer(code):
        ipath = match.group('file')
        itype = match.group('type')
        Logs.debug("rst: visiting %s: %s" % (itype, ipath))
        found = node.parent.find_resource(ipath)
        if found:
            nodes.append(found)
            if itype == 'include':
                parse_rst_node(found, nodes, names, seen)
        else:
            names.append(ipath)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号