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