Exemplo n.º 1
0
 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>'))
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 def analyse_text(text):
     rv = 0.0
     if re.search("val \w+\s*:", text):
         rv += 0.6
     if looks_like_xml(text):
         rv += 0.2
     if "<%" in text and "%>" in text:
         rv += 0.1
     return rv
Exemplo n.º 6
0
 def analyse_text(text):
     if not looks_like_xml(text) and \
        ('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
         return 0.8
Exemplo n.º 7
0
 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>'))
Exemplo n.º 8
0
 def analyse_text(text):
     if looks_like_xml(text):
         return 0.5
Exemplo n.º 9
0
Arquivo: html.py Projeto: axil/blog
 def analyse_text(text):
     if looks_like_xml(text) and '<xsl' in text:
         return 0.8
Exemplo n.º 10
0
 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>"))
Exemplo n.º 11
0
def test_xml():
    assert util.looks_like_xml(
        '<?xml ?><!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Strict//EN">')
    assert util.looks_like_xml('<html xmlns>abc</html>')
    assert not util.looks_like_xml('<html>')
Exemplo n.º 12
0
 def analyse_text(text):
     if looks_like_xml(text):
         return 0.5
Exemplo n.º 13
0
 def analyse_text(text):
     rv = PhpLexer.analyse_text(text) - 0.01
     if looks_like_xml(text):
         rv += 0.4
     return rv
Exemplo n.º 14
0
 def analyse_text(text):
     rv = VelocityLexer.analyse_text(text) - 0.01
     if looks_like_xml(text):
         rv += 0.5
     return rv
Exemplo n.º 15
0
 def analyse_text(text):
     if looks_like_xml(text):
         return 0.45  # less than HTML
Exemplo n.º 16
0
Arquivo: html.py Projeto: axil/blog
 def analyse_text(text):
     if not looks_like_xml(text) and \
        ('<!ELEMENT' in text or '<!ATTLIST' in text or '<!ENTITY' in text):
         return 0.8
Exemplo n.º 17
0
 def analyse_text(text):
     if looks_like_xml(text) and '<xsl' in text:
         return 0.8
Exemplo n.º 18
0
Arquivo: html.py Projeto: axil/blog
 def analyse_text(text):
     if looks_like_xml(text):
         return 0.45  # less than HTML
Exemplo n.º 19
0
 def analyse_text(text):
     rv = PhpLexer.analyse_text(text) - 0.01
     if looks_like_xml(text):
         rv += 0.4
     return rv
Exemplo n.º 20
0
 def analyse_text(text):
     rv = VelocityLexer.analyse_text(text) - 0.01
     if looks_like_xml(text):
         rv += 0.5
     return rv