manuscript.py 文件源码

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

项目:manubot 作者: greenelab 项目源码 文件源码
def replace_citations_strings_with_ids(text, string_to_id):
    """
    Convert citations to their IDs for pandoc.

    `text` is markdown source text

    `string_to_id` is a dictionary like:
    @10.7287/peerj.preprints.3100v1 ? 11cb5HXoY
    """
    for old, new in string_to_id.items():
        text = re.sub(
            pattern=re.escape(old) + r'(?![\w:.#$%&\-+?<>~/]*[a-zA-Z0-9/])',
            repl='@' + new,
            string=text,
        )
    return text
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号