summaryrefslogtreecommitdiff
path: root/sphinx/ext/viewcode.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-09-22 10:42:09 +0200
committerGeorg Brandl <georg@python.org>2011-09-22 10:42:09 +0200
commitc5599ea28eeac416ab4646a9ef1b9eb3d783f8b7 (patch)
tree76a1db0ec536f130b4394c48be68fee820d8024b /sphinx/ext/viewcode.py
parentccef6db7cb04db18258c41a4fd5af6384525737a (diff)
parent7cabc9f2a989a78753f9ddcbfd941dd3fc45e106 (diff)
downloadsphinx-c5599ea28eeac416ab4646a9ef1b9eb3d783f8b7.tar.gz
Merge with 1.0
Diffstat (limited to 'sphinx/ext/viewcode.py')
-rw-r--r--sphinx/ext/viewcode.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py
index 4994f125..32840f30 100644
--- a/sphinx/ext/viewcode.py
+++ b/sphinx/ext/viewcode.py
@@ -31,7 +31,11 @@ def doctree_read(app, doctree):
env._viewcode_modules[modname] = False
return
analyzer.find_tags()
- entry = analyzer.code.decode(analyzer.encoding), analyzer.tags, {}
+ if not isinstance(analyzer.code, unicode):
+ code = analyzer.code.decode(analyzer.encoding)
+ else:
+ code = analyzer.code
+ entry = code, analyzer.tags, {}
env._viewcode_modules[modname] = entry
elif entry is False:
return
@@ -94,7 +98,7 @@ def collect_pages(app):
# construct a page name for the highlighted source
pagename = '_modules/' + modname.replace('.', '/')
# highlight the source using the builder's highlighter
- highlighted = highlighter.highlight_block(code, 'python', False)
+ highlighted = highlighter.highlight_block(code, 'python', linenos=False)
# split the code into lines
lines = highlighted.splitlines()
# split off wrap markup from the first line of the actual code