__init__.py 文件源码

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

项目:chalktalk_docs 作者: loremIpsum1771 项目源码 文件源码
def dispatch_visit(self, node):
        nodetype = type(node)
        if issubclass(nodetype, comment):
            raise SkipNode
        if issubclass(nodetype, raw):
            # Some people might put content in raw HTML that should be searched,
            # so we just amateurishly strip HTML tags and index the remaining
            # content
            nodetext = re.sub(r'(?is)<style.*?</style>', '', node.astext())
            nodetext = re.sub(r'(?is)<script.*?</script>', '', nodetext)
            nodetext = re.sub(r'<[^<]+?>', '', nodetext)
            self.found_words.extend(self.lang.split(nodetext))
            raise SkipNode
        if issubclass(nodetype, Text):
            self.found_words.extend(self.lang.split(node.astext()))
        elif issubclass(nodetype, title):
            self.found_title_words.extend(self.lang.split(node.astext()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号