Commits

Eric Knibbe  committed 5ecda1a

better analyse_text methods to address issue #845

  • Participants
  • Parent commits 27e833c

Comments (0)

Files changed (2)

File pygments/lexers/templates.py

         super(LassoHtmlLexer, self).__init__(HtmlLexer, LassoLexer, **options)
 
     def analyse_text(text):
-        rv = LassoLexer.analyse_text(text)
+        rv = LassoLexer.analyse_text(text) - 0.01
         if re.search(r'<\w+>', text, re.I):
             rv += 0.2
         if html_doctype_matches(text):
         super(LassoXmlLexer, self).__init__(XmlLexer, LassoLexer, **options)
 
     def analyse_text(text):
-        rv = LassoLexer.analyse_text(text)
+        rv = LassoLexer.analyse_text(text) - 0.01
         if looks_like_xml(text):
-            rv += 0.5
+            rv += 0.4
         return rv
 
 
         super(LassoCssLexer, self).__init__(CssLexer, LassoLexer, **options)
 
     def analyse_text(text):
-        rv = LassoLexer.analyse_text(text)
-        if re.search(r'\w+:.+;', text):
+        rv = LassoLexer.analyse_text(text) - 0.05
+        if re.search(r'\w+:.+?;', text):
             rv += 0.1
         if 'padding:' in text:
             rv += 0.1
                                                    **options)
 
     def analyse_text(text):
-        rv = LassoLexer.analyse_text(text)
+        rv = LassoLexer.analyse_text(text) - 0.05
         if 'function' in text:
             rv += 0.2
         return rv

File pygments/lexers/web.py

         rv = 0.0
         if 'bin/lasso9' in text:
             rv += 0.8
-        if re.search(r'<\?(=|lasso)', text, re.I):
+        if re.search(r'<\?(=|lasso)|\A\[', text, re.I):
             rv += 0.4
         if re.search(r'local\(', text, re.I):
             rv += 0.4
-        if re.search(r'\[\n|\?>', text):
-            rv += 0.4
+        if '?>' in text:
+            rv += 0.1
         return rv