Anonymous avatar Anonymous committed 15d12e1

[svn] added JavascriptGenshiLexer and CssGenshiLexer

Comments (0)

Files changed (2)

pygments/lexers/_mapping.py

     'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++')),
     'CssDjangoLexer': ('pygments.lexers.templates', 'CSS+Django', ('css+django',), ()),
     'CssErbLexer': ('pygments.lexers.templates', 'CSS+Ruby', ('css+erb', 'css+ruby'), ()),
+    'CssGenshiLexer': ('pygments.lexers.templates', 'CSS+Genshi Text', ('css+genshitext', 'css+genshi'), ()),
     'CssLexer': ('pygments.lexers.web', 'CSS', ('css',), ('*.css',)),
     'CssPhpLexer': ('pygments.lexers.templates', 'CSS+PHP', ('css+php',), ()),
     'CssSmartyLexer': ('pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), ()),
     'DjangoLexer': ('pygments.lexers.templates', 'django template', ('django',), ()),
     'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), ()),
     'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',)),
-    'GenshiTextLexer': ('pygments.lexers.templates', None, ('genshitext',), ()),
+    'GenshiTextLexer': ('pygments.lexers.templates', 'Genshi Text', ('genshitext',), ()),
     'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django', ('html+django',), ()),
     'HtmlGenshiLexer': ('pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), ()),
     'HtmlLexer': ('pygments.lexers.web', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml')),
     'JavaLexer': ('pygments.lexers.compiled', 'Java', ('java',), ('*.java',)),
     'JavascriptDjangoLexer': ('pygments.lexers.templates', 'JavaScript+Django', ('js+django', 'javascript+django'), ()),
     'JavascriptErbLexer': ('pygments.lexers.templates', 'JavaScript+Ruby', ('js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby'), ()),
+    'JavascriptGenshiLexer': ('pygments.lexers.templates', 'JavaScript+Genshi Text', ('js+genshitext', 'js+genshi', 'javascript+genshitext', 'javascript+genshi'), ()),
     'JavascriptLexer': ('pygments.lexers.web', 'JavaScript', ('js', 'javascript'), ('*.js',)),
     'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('js+php', 'javascript+php'), ()),
     'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('js+smarty', 'javascript+smarty'), ()),

pygments/lexers/templates.py

            'CssSmartyLexer', 'JavascriptSmartyLexer', 'DjangoLexer',
            'HtmlDjangoLexer', 'CssDjangoLexer', 'XmlDjangoLexer',
            'JavascriptDjangoLexer', 'GenshiLexer', 'HtmlGenshiLexer',
-           'GenshiTextLexer']
+           'GenshiTextLexer', 'CssGenshiLexer', 'JavascriptGenshiLexer']
 
 
 class ErbLexer(Lexer):
 class GenshiTextLexer(RegexLexer):
     aliases = ['genshitext']
 
+class GenshiTextLexer(RegexLexer):
+    name = 'Genshi Text'
+    aliases = ['genshitext']
+
     tokens = {
         'root': [
             (r'[^#\$\s]+', Text),
         ]
     }
 
+
 class GenshiMarkupLexer(RegexLexer):
     flags = re.DOTALL
 
         return rv + XmlLexer.analyse_text(text) - 0.01
 
 
+class JavascriptGenshiLexer(DelegatingLexer):
+    name = 'JavaScript+Genshi Text'
+    aliases = ['js+genshitext', 'js+genshi', 'javascript+genshitext',
+               'javascript+genshi']
+
+    def __init__(self, **options):
+        super(JavascriptGenshiLexer, self).__init__(JavascriptLexer,
+                                                    GenshiTextLexer,
+                                                    **options)
+
+
+class CssGenshiLexer(DelegatingLexer):
+    name = 'CSS+Genshi Text'
+    aliases = ['css+genshitext', 'css+genshi']
+
+    def __init__(self, **options):
+        super(CssGenshiLexer, self).__init__(CssLexer, GenshiTextLexer,
+                                             **options)
+
+
 class RhtmlLexer(DelegatingLexer):
     name = 'RHTML'
     aliases = ['rhtml', 'html+erb', 'html+ruby']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.