summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-16 12:25:35 +0200
committerGeorg Brandl <georg@python.org>2014-10-16 12:25:35 +0200
commit33cc6d165e96ceb19cda82925eeb71a1cfb15c14 (patch)
treee735a82e35c590b7eed776b0121be1dc732834b2
parent5d4c474a213311b24c119cb63a34f8d74dafe2c0 (diff)
downloadpygments-33cc6d165e96ceb19cda82925eeb71a1cfb15c14.tar.gz
Fix sphinx extension for doc gen.
-rw-r--r--pygments/sphinxext.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pygments/sphinxext.py b/pygments/sphinxext.py
index 5ab8f060..82bc6543 100644
--- a/pygments/sphinxext.py
+++ b/pygments/sphinxext.py
@@ -124,9 +124,11 @@ class PygmentsDoc(Directive):
from pygments.formatters import FORMATTERS
out = []
- for cls, data in sorted(FORMATTERS.items(),
- key=lambda x: x[0].__name__):
- self.filenames.add(sys.modules[cls.__module__].__file__)
+ for classname, data in sorted(FORMATTERS.items(), key=lambda x: x[0]):
+ module = data[0]
+ mod = __import__(module, None, None, [classname])
+ self.filenames.add(mod.__file__)
+ cls = getattr(mod, classname)
docstring = cls.__doc__
if isinstance(docstring, bytes):
docstring = docstring.decode('utf8')