python类Comment()的实例源码

_lxml.py 文件源码 项目:Gank-Alfred-Workflow 作者: hujiaweibujidao 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:Taigabot 作者: FrozenPigs 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:Crunchyroll-XML-Decoder 作者: jaw20 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:script.quasar.t411-rik91 作者: rik91 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:-PunkScan 作者: swordli 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:-PunkScan 作者: swordli 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:gerador-horarios 作者: colobas 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:punkspider 作者: aiwennba 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:punkspider 作者: aiwennba 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
elements.py 文件源码 项目:zpretty 作者: collective 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def is_comment(self):
        ''' Check if this element is a comment
        '''
        return isinstance(self.context, Comment)
_lxml.py 文件源码 项目:open-safari-simulator-applescript 作者: realjade 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
_lxml.py 文件源码 项目:AstroCoffee 作者: abhimat 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)
test_html5lib.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_cdata_where_it_doesnt_belong(self):
        # Random CDATA sections are converted into comments.
        markup = "<div><![CDATA[foo]]>"
        soup = self.soup(markup)
        data = soup.find(text="[CDATA[foo]]")
        self.assertEqual(data.__class__, Comment)
test_html5lib.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_incomplete_declaration(self):
        # An incomplete declaration is treated as a comment.
        markup = 'a<!b <p>c'
        self.assertSoupEquals(markup, "a<!--b <p-->c")

        # Let's spell that out a little more explicitly.
        soup = self.soup(markup)
        str1, comment, str2 = soup.body.contents
        self.assertEqual(str1, 'a')
        self.assertEqual(comment.__class__, Comment)
        self.assertEqual(comment, 'b <p')
        self.assertEqual(str2, 'c')
test_html5lib.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_document_starts_with_bogus_declaration(self):
        soup = self.soup('<! Foo >a')
        # 'Foo' becomes a comment that appears before the HTML.
        comment = soup.contents[0]
        self.assertTrue(isinstance(comment, Comment))
        self.assertEqual(comment, 'Foo')

        self.assertEqual(self.find(text="a") == "a")
test_html5lib.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_document_starts_with_bogus_declaration(self):
        soup = self.soup('<! Foo ><p>a</p>')
        # The declaration becomes a comment.
        comment = soup.contents[0]
        self.assertTrue(isinstance(comment, Comment))
        self.assertEqual(comment, ' Foo ')
        self.assertEqual(soup.p.string, 'a')
test_html5lib.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_document_ends_with_incomplete_declaration(self):
        soup = self.soup('<p>a<!b')
        # This becomes a string 'a'. The incomplete declaration is ignored.
        # Compare html5lib, which turns it into a comment.
        s, comment = soup.p.contents
        self.assertEqual(s, 'a')
        self.assertTrue(isinstance(comment, Comment))
        self.assertEqual(comment, 'b')
_lxml.py 文件源码 项目:sack 作者: jofpin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def comment(self, content):
        "Handle comments as Comment objects."
        self.soup.endData()
        self.soup.handle_data(content)
        self.soup.endData(Comment)


问题


面经


文章

微信
公众号

扫码关注公众号