Ejemplo n.º 1
0
 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">'))
Ejemplo n.º 2
0
 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">'))
Ejemplo n.º 3
0
 def analyse_text(text):
     rv = SmartyLexer.analyse_text(text) - 0.01
     if html_doctype_matches(text):
         rv += 0.5
     return rv
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 def analyse_text(text):
     if html_doctype_matches(text):
         return 0.5
Ejemplo n.º 6
0
Archivo: html.py Proyecto: axil/blog
 def analyse_text(text):
     if html_doctype_matches(text):
         return 0.5
Ejemplo n.º 7
0
def test_doctype_matches():
    assert util.doctype_matches('<!DOCTYPE html> <html>', 'html.*')
    assert not util.doctype_matches(
        '<?xml ?> <DOCTYPE html PUBLIC "a"> <html>', 'html.*')
    assert util.html_doctype_matches(
        '<?xml ?><!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Strict//EN">')
Ejemplo n.º 8
0
 def analyse_text(text):
     rv = PhpLexer.analyse_text(text) - 0.01
     if html_doctype_matches(text):
         rv += 0.5
     return rv
Ejemplo n.º 9
0
 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
Ejemplo n.º 10
0
 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">'))