summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hammond <christian@beanbaginc.com>2017-01-22 12:30:00 -0800
committerChristian Hammond <christian@beanbaginc.com>2017-01-22 12:30:00 -0800
commita364d3742833e2b12d54622b317f7b1187594bf4 (patch)
tree0793a60e389983f07d31f064b5104553cb9239a0
parentb55bc4bf9bec1e3454d38f5c3dc103ffd9fdc75d (diff)
downloadpygments-a364d3742833e2b12d54622b317f7b1187594bf4.tar.gz
Remove the fallback values from the new analyse_text changes.
These values would trigger problems when guessing content without a filename, and really aren't needed. They've been removed, allowing the standard behavior to take place. On top of this, the regex for TypeScript has been slightly altered to include a whitespace match after "export" to be within the group for the "export" text.
-rw-r--r--pygments/lexers/javascript.py6
-rw-r--r--pygments/lexers/typoscript.py4
2 files changed, 1 insertions, 9 deletions
diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py
index 76b226c2..093e75e3 100644
--- a/pygments/lexers/javascript.py
+++ b/pygments/lexers/javascript.py
@@ -518,13 +518,9 @@ class TypeScriptLexer(RegexLexer):
def analyse_text(text):
if re.search('^(import.+(from\s+)?["\']|'
- '(export)?\s*(interface|class|function)\s+)',
+ '(export\s*)?(interface|class|function)\s+)',
text, re.MULTILINE):
return 1.0
- else:
- # Slightly lower than TypoScript, since we have more we can look
- # for in TypeScript content.
- return 0.8
class LassoLexer(RegexLexer):
diff --git a/pygments/lexers/typoscript.py b/pygments/lexers/typoscript.py
index d1f09d90..ff53490a 100644
--- a/pygments/lexers/typoscript.py
+++ b/pygments/lexers/typoscript.py
@@ -226,7 +226,3 @@ class TypoScriptLexer(RegexLexer):
def analyse_text(text):
if '<INCLUDE_TYPOSCRIPT:' in text:
return 1.0
- else:
- # Slightly higher than TypeScript, since there's less to rely
- # on in TypoScript content.
- return 0.9