main.py 文件源码

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

项目:coq-rst 作者: cpitclaudel 项目源码 文件源码
def lex(source):
    """Convert source into a stream of (css_classes, token_string)."""
    soup = BeautifulSoup(coqdoc(source))
    root = soup.find(class_='code')
    strip_soup(root, is_whitespace_string)
    for elem in root.children:
        if isinstance(elem, NavigableString):
            yield [], elem
        elif elem.name == "span":
            cls = "coqdoc-{}".format(elem['type'])
            yield [cls], elem.string
        elif elem.name == 'br':
            pass
        else:
            raise ValueError(elem)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号