Skip to content

Commit

Permalink
Allow users to specify pygments style
Browse files Browse the repository at this point in the history
  • Loading branch information
honza committed Apr 5, 2012
1 parent aa8f13e commit 05f9ff3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Env settings
mongo`)
* `SPRUNGE_MONGO_DB_NAME` - the string after the last slash on
`SPRUNGE_MONGO_URI`
* `SPRUNGE_STYLE` - Pygments style (defaults to `default`)


Set these with:
Expand Down
2 changes: 1 addition & 1 deletion sprunge/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def snip(uid):
except:
lexer = pygments.lexers.TextLexer()
formatter = HtmlFormatter(full=True,
style='borland', lineanchors='n', linenos='inline',
style=STYLE, linenos='inline',
encoding='utf-8')
return highlight(data['content'], lexer, formatter)
else:
Expand Down
5 changes: 5 additions & 0 deletions sprunge/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ def get_value(key):
NAME = get_value('NAME') # the POST payload key
MONGO_URI = get_value('MONGO_URI')
MONGO_DB_NAME = get_value('MONGO_DB_NAME')

try:
STYLE = os.environ['SPRUNGE_STYLE']
except:
STYLE = 'default'

0 comments on commit 05f9ff3

Please sign in to comment.