Commits

Tobias Berling  committed b9248cb

Highlight style can now be set via URL.

  • Participants
  • Parent commits 2746586

Comments (0)

Files changed (1)

 
     from pygments import highlight
     from pygments.lexers import get_lexer_by_name
+    from pygments.styles import STYLE_MAP
     from pygments.formatters import HtmlFormatter
 
     lang = a.keys()[0]
     except:
         lexer = get_lexer_by_name('text')
 
+    style = a.get('style', 'tango')
+    if not style in STYLE_MAP.keys():
+        style = 'tango'
+
     return highlight(content,
                      lexer,
                      HtmlFormatter(full=True,
-                                   style='borland',
+                                   style=style,
                                    lineanchors='l',
                                    linenos='inline',
                                    encoding='utf-8'))
 
 if __name__ == '__main__':
     app.debug = True
-    app.run(host='0.0.0.0')
+    app.run()