[Python-checkins] r59915 - doctools/trunk/sphinx/roles.py
georg.brandl
python-checkins at python.org
Fri Jan 11 15:08:11 CET 2008
Author: georg.brandl
Date: Fri Jan 11 15:08:11 2008
New Revision: 59915
Modified:
doctools/trunk/sphinx/roles.py
Log:
Remove parentheses if the occur in :func: etc. roles.
Modified: doctools/trunk/sphinx/roles.py
==============================================================================
--- doctools/trunk/sphinx/roles.py (original)
+++ doctools/trunk/sphinx/roles.py Fri Jan 11 15:08:11 2008
@@ -105,9 +105,13 @@
def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
env = inliner.document.settings.env
text = utils.unescape(text)
- if typ in ('func', 'meth', 'cfunc') and \
- env.config.get('add_function_parentheses', True):
- text += '()'
+ if typ in ('func', 'meth', 'cfunc'):
+ if text.endswith('()'):
+ # remove parentheses
+ text = text[:-2]
+ if env.config.get('add_function_parentheses', True):
+ # add them back to all occurrences if configured
+ text += '()'
# if the first character is a bang, don't cross-reference at all
if text[0:1] == '!':
text = text[1:]
More information about the Python-checkins
mailing list