Commits

Anonymous committed 6579c5e

pygments_style can be an import path now

  • Participants
  • Parent commits a0f6c75

Comments (0)

Files changed (2)

+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)
 ==========================
 

File sphinx/highlighting.py

             return
         if stylename == 'sphinx':
             style = SphinxStyle
-        elif isinstance(stylename, basestring):
+        elif '.' in stylename:
+            module, stylename = stylename.rsplit('.', 1)
+            style = getattr(__import__(module, None, None, ['']), stylename)
+        else:
             style = get_style_by_name(stylename)
-        else:
-            style = stylename
         self.hfmter = {False: HtmlFormatter(style=style),
                        True: HtmlFormatter(style=style, linenos=True)}
         self.lfmter = {False: LatexFormatter(style=style),