linkcheck.py 文件源码

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

项目:python-tutorial 作者: Akuli 项目源码 文件源码
def find_links(this_file):
    """Read links of a markdown file.

    Return a list of (target, title, lineno) pairs where title can be None.
    """
    result = []

    with common.slashfix_open(this_file, 'r') as f:
        for match, lineno in common.find_links(f):
            target = match.group(2)
            if '#' in target:
                file, title = target.split('#', 1)
                if not file:
                    # link to this file, [blabla](#hi)
                    file = posixpath.basename(this_file)
            else:
                file = target
                title = None

            result.append((file, title, lineno))

    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号