diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-08 23:00:12 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-08 23:00:12 -0400 |
commit | 9e7440c01d917021790e896f47ef834770ae1d62 (patch) | |
tree | 51c99bc68861598ca401ee7b5094fe3fa214db16 | |
parent | bd11d3db31cc207d794d500c9caa3508e10dacb5 (diff) | |
download | cgit-syntax-highlighting-9e7440c01d917021790e896f47ef834770ae1d62.tar.xz cgit-syntax-highlighting-9e7440c01d917021790e896f47ef834770ae1d62.zip |
exclude SqlLexer from guessing
-rwxr-xr-x | syntax-highlighting-server.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/syntax-highlighting-server.py b/syntax-highlighting-server.py index 48482cc..aa6c570 100755 --- a/syntax-highlighting-server.py +++ b/syntax-highlighting-server.py @@ -70,6 +70,9 @@ class HighlightingHandler(BaseHTTPRequestHandler): except ClassNotFound: try: lexer = guess_lexer(data) + # SqlLexer always gives 0.01 + if lexer.analyse_text(data) <= 0.01: + lexer = TextLexer() except ClassNotFound: lexer = TextLexer() self.wfile.write(('<!-- Lexer: ' + lexer.name + |