mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Fixed lexer key validation. Fixed tests.
This commit is contained in:
parent
a3b8c8a7a7
commit
bbd68ee2c9
1 changed files with 4 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.lexers import *
|
from pygments.lexers import *
|
||||||
from pygments.formatters import HtmlFormatter
|
from pygments.formatters import HtmlFormatter
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Get a list of all lexer, and then remove all lexer which have '-' or '+'
|
# Get a list of all lexer, and then remove all lexer which have '-' or '+'
|
||||||
|
@ -25,7 +27,7 @@ LEXER_LIST = sorted(LEXER_LIST)
|
||||||
LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', (
|
LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', (
|
||||||
('text', 'Text'),
|
('text', 'Text'),
|
||||||
('code', 'Code'),
|
('code', 'Code'),
|
||||||
('Specific Code', (
|
(_('Specific Code'), (
|
||||||
('abap', 'ABAP'),
|
('abap', 'ABAP'),
|
||||||
('apacheconf', 'ApacheConf'),
|
('apacheconf', 'ApacheConf'),
|
||||||
('applescript', 'AppleScript'),
|
('applescript', 'AppleScript'),
|
||||||
|
@ -97,7 +99,7 @@ LEXER_LIST = getattr(settings, 'DPASTE_LEXER_LIST', (
|
||||||
))
|
))
|
||||||
))
|
))
|
||||||
|
|
||||||
LEXER_KEYS = dict(LEXER_LIST).keys()
|
LEXER_KEYS = ['text', 'code'] + [i for i in dict(LEXER_LIST[2][1]).keys()]
|
||||||
|
|
||||||
# The default lexer is python
|
# The default lexer is python
|
||||||
LEXER_DEFAULT = getattr(settings, 'DPASTE_LEXER_DEFAULT', 'python')
|
LEXER_DEFAULT = getattr(settings, 'DPASTE_LEXER_DEFAULT', 'python')
|
||||||
|
|
Loading…
Reference in a new issue