diff MoinMoin/apps/admin/views.py @ 91:2e0766600e8f

admin/highlighterhelp view (replaces HighlighterList macro), added table macro to utils.html template
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 07 Mar 2011 20:19:03 +0100
parents 32b88d45d63c
children 5ff01f07c67c
line wrap: on
line diff
--- a/MoinMoin/apps/admin/views.py	Mon Mar 07 19:33:02 2011 +0100
+++ b/MoinMoin/apps/admin/views.py	Mon Mar 07 20:19:03 2011 +0100
@@ -1,6 +1,7 @@
 # Copyright: 2008-2011 MoinMoin:ThomasWaldmann
 # Copyright: 2001-2003 Juergen Hermann <jh@web.de>
 # Copyright: 2008 MoinMoin:JohannesBerg
+# Copyright: 2009 MoinMoin:EugeneSyromyatnikov
 # Copyright: 2010 MoinMoin:DiogenesAugusto
 # Copyright: 2010 MoinMoin:ReimarBauer
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
@@ -190,3 +191,21 @@
                            item_name="+admin/wikiconfighelp",
                            groups=groups)
 
+
+@admin.route('/highlighterhelp', methods=['GET', ])
+def highlighterhelp():
+    """display a table with list of available Pygments lexers"""
+    import pygments.lexers
+    headings = [_('Lexer description'),
+                _('Lexer names'),
+                _('File patterns'),
+                _('Mimetypes'),
+               ]
+    lexers = pygments.lexers.get_all_lexers()
+    rows = sorted([[desc, ' '.join(names), ' '.join(patterns), ' '.join(mimetypes), ]
+                   for desc, names, patterns, mimetypes in lexers])
+    return render_template('admin/highlighterhelp.html',
+                           item_name="+admin/highlighterhelp",
+                           headings=headings,
+                           rows=rows)
+