mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Fix compatibility with upcoming Sphinx 1.2.
This commit is contained in:
		
							parent
							
								
									e23b2d06c7
								
							
						
					
					
						commit
						239990daec
					
				
					 1 changed files with 17 additions and 16 deletions
				
			
		|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
|     Sphinx extension with Python doc-specific markup. | ||||
| 
 | ||||
|     :copyright: 2008, 2009, 2010, 2011, 2012 by Georg Brandl. | ||||
|     :copyright: 2008-2013 by Georg Brandl. | ||||
|     :license: Python license. | ||||
| """ | ||||
| 
 | ||||
|  | @ -13,7 +13,12 @@ | |||
| SOURCE_URI = 'http://hg.python.org/cpython/file/3.3/%s' | ||||
| 
 | ||||
| from docutils import nodes, utils | ||||
| 
 | ||||
| import sphinx | ||||
| from sphinx.util.nodes import split_explicit_title | ||||
| from sphinx.writers.html import HTMLTranslator | ||||
| from sphinx.writers.latex import LaTeXTranslator | ||||
| from sphinx.locale import versionlabels | ||||
| 
 | ||||
| # monkey-patch reST parser to disable alphabetic and roman enumerated lists | ||||
| from docutils.parsers.rst.states import Body | ||||
|  | @ -22,6 +27,7 @@ | |||
|     Body.enum.converters['lowerroman'] = \ | ||||
|     Body.enum.converters['upperroman'] = lambda x: None | ||||
| 
 | ||||
| if sphinx.__version__[:3] < '1.2': | ||||
|     # monkey-patch HTML translator to give versionmodified paragraphs a class | ||||
|     def new_visit_versionmodified(self, node): | ||||
|         self.body.append(self.starttag(node, 'p', CLASS=node['type'])) | ||||
|  | @ -31,11 +37,6 @@ def new_visit_versionmodified(self, node): | |||
|         else: | ||||
|             text += '.' | ||||
|         self.body.append('<span class="versionmodified">%s</span> ' % text) | ||||
| 
 | ||||
| from sphinx.writers.html import HTMLTranslator | ||||
| from sphinx.writers.latex import LaTeXTranslator | ||||
| from sphinx.locale import versionlabels | ||||
| HTMLTranslator.visit_versionmodified = new_visit_versionmodified | ||||
|     HTMLTranslator.visit_versionmodified = new_visit_versionmodified | ||||
| 
 | ||||
| # monkey-patch HTML and LaTeX translators to keep doctest blocks in the | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Georg Brandl
						Georg Brandl