本文整理汇总了Python中pygments.util.html_doctype_matches函数的典型用法代码示例。如果您正苦于以下问题:Python html_doctype_matches函数的具体用法?Python html_doctype_matches怎么用?Python html_doctype_matches使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_doctype_matches函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_doctype_matches
def test_doctype_matches(self):
self.assert_(util.doctype_matches('<!DOCTYPE html PUBLIC "a"> <html>',
'html.*'))
self.failIf(util.doctype_matches('<?xml ?> <DOCTYPE html PUBLIC "a"> <html>',
'html.*'))
self.assert_(util.html_doctype_matches(
'<?xml ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">'))
示例2: analyse_text
def analyse_text(text):
if html_doctype_matches(text):
return 0.5
示例3: analyse_text
def analyse_text(text):
rv = ErbLexer.analyse_text(text) - 0.01
if html_doctype_matches(text):
# one more than the XmlErbLexer returns
rv += 0.5
return rv
示例4: test_doctype_matches
def test_doctype_matches(self):
self.assertTrue(util.doctype_matches('<!DOCTYPE html PUBLIC "a"> <html>', "html.*"))
self.assertFalse(util.doctype_matches('<?xml ?> <DOCTYPE html PUBLIC "a"> <html>', "html.*"))
self.assertTrue(util.html_doctype_matches('<?xml ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">'))