[Python-checkins] r66931 - in doctools/trunk: CHANGES sphinx/roles.py tests/root/markup.txt

georg.brandl python-checkins at python.org
Thu Oct 16 22:41:05 CEST 2008


Author: georg.brandl
Date: Thu Oct 16 22:41:05 2008
New Revision: 66931

Log:
Role names are case-insensitive. #24.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/roles.py
   doctools/trunk/tests/root/markup.txt

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Thu Oct 16 22:41:05 2008
@@ -118,6 +118,8 @@
 
 * Fix LaTeX build for some description environments with ``:noindex:``.
 
+* Don't crash on weird casing of role names (like ``:Class:``).
+
 
 Release 0.4.3 (Oct 8, 2008)
 ===========================

Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py	(original)
+++ doctools/trunk/sphinx/roles.py	Thu Oct 16 22:41:05 2008
@@ -41,6 +41,8 @@
     env = inliner.document.settings.env
     if not typ:
         typ = env.config.default_role
+    else:
+        typ = typ.lower()
     text = utils.unescape(etext)
     targetid = 'index-%s' % env.index_num
     env.index_num += 1
@@ -112,6 +114,8 @@
     env = inliner.document.settings.env
     if not typ:
         typ = env.config.default_role
+    else:
+        typ = typ.lower()
     text = utils.unescape(text)
     # if the first character is a bang, don't cross-reference at all
     if text[0:1] == '!':
@@ -190,7 +194,7 @@
 def emph_literal_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
     text = utils.unescape(text)
     pos = 0
-    retnode = nodes.literal(role=typ)
+    retnode = nodes.literal(role=typ.lower())
     for m in _litvar_re.finditer(text):
         if m.start() > pos:
             txt = text[pos:m.start()]

Modified: doctools/trunk/tests/root/markup.txt
==============================================================================
--- doctools/trunk/tests/root/markup.txt	(original)
+++ doctools/trunk/tests/root/markup.txt	Thu Oct 16 22:41:05 2008
@@ -62,6 +62,8 @@
 
 This is a side note.
 
+This tests :CLASS:`role names in uppercase`.
+
 .. centered:: LICENSE AGREEMENT
 
 .. acks::


More information about the Python-checkins mailing list