mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
pygments_style can be an import path now
This commit is contained in:
parent
df27e62743
commit
2e96cea026
10
CHANGES
10
CHANGES
@ -1,3 +1,13 @@
|
||||
Release 0.3 (TBA)
|
||||
=================
|
||||
|
||||
New features added
|
||||
------------------
|
||||
|
||||
* If the `pygments_style` contains a dot it's treated as import path and
|
||||
used as style class.
|
||||
|
||||
|
||||
Release 0.2 (Apr 27, 2008)
|
||||
==========================
|
||||
|
||||
|
@ -87,10 +87,11 @@ class PygmentsBridge(object):
|
||||
return
|
||||
if stylename == 'sphinx':
|
||||
style = SphinxStyle
|
||||
elif isinstance(stylename, basestring):
|
||||
style = get_style_by_name(stylename)
|
||||
elif '.' in stylename:
|
||||
module, stylename = stylename.rsplit('.', 1)
|
||||
style = getattr(__import__(module, None, None, ['']), stylename)
|
||||
else:
|
||||
style = stylename
|
||||
style = get_style_by_name(stylename)
|
||||
self.hfmter = {False: HtmlFormatter(style=style),
|
||||
True: HtmlFormatter(style=style, linenos=True)}
|
||||
self.lfmter = {False: LatexFormatter(style=style),
|
||||
|
Loading…
Reference in New Issue
Block a user