[Python-checkins] r58585 - doctools/trunk/sphinx/directives.py doctools/trunk/sphinx/roles.py doctools/trunk/sphinx/writer.py

georg.brandl python-checkins at python.org
Sun Oct 21 14:53:42 CEST 2007


Author: georg.brandl
Date: Sun Oct 21 14:53:41 2007
New Revision: 58585

Modified:
   doctools/trunk/sphinx/directives.py
   doctools/trunk/sphinx/roles.py
   doctools/trunk/sphinx/writer.py
Log:
* Lowercase glossary terms
* Consistently format None, True and False.


Modified: doctools/trunk/sphinx/directives.py
==============================================================================
--- doctools/trunk/sphinx/directives.py	(original)
+++ doctools/trunk/sphinx/directives.py	Sun Oct 21 14:53:41 2007
@@ -643,7 +643,8 @@
             env.gloss_entries.add(new_id)
             li[0]['names'].append(new_id)
             li[0]['ids'].append(new_id)
-            state.document.settings.env.note_reftarget('term', termtext, new_id)
+            state.document.settings.env.note_reftarget('term', termtext.lower(),
+                                                       new_id)
     return [node]
 
 glossary_directive.content = 1

Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py	(original)
+++ doctools/trunk/sphinx/roles.py	Sun Oct 21 14:53:41 2007
@@ -117,7 +117,7 @@
         text = text[1:]
         pnode['refspecific'] = True
     if typ == 'term':
-        pnode['reftarget'] = ws_re.sub(' ', text)
+        pnode['reftarget'] = ws_re.sub(' ', text).lower()
     elif typ == 'option':
         pnode['reftarget'] = text[1:] if text[0] in '-/' else text
     else:

Modified: doctools/trunk/sphinx/writer.py
==============================================================================
--- doctools/trunk/sphinx/writer.py	(original)
+++ doctools/trunk/sphinx/writer.py	Sun Oct 21 14:53:41 2007
@@ -160,6 +160,13 @@
             self.body.append(highlight_block(node.rawsource, self.highlightlang))
             raise nodes.SkipNode
 
+        # overwritten
+        def visit_literal(self, node):
+            if len(node.children) == 1 and \
+                   node.children[0] in ('None', 'True', 'False'):
+                node['classes'].append('xref')
+            BaseTranslator.visit_literal(self, node)
+
         def visit_productionlist(self, node):
             self.body.append(self.starttag(node, 'pre'))
             names = []


More information about the Python-checkins mailing list