From 144992dd9b33715221ea124a8c5338446b9454df Mon Sep 17 00:00:00 2001 From: David Fraser Date: Tue, 17 Mar 2015 14:59:49 +0000 Subject: [PATCH] Don't replace `double` with `float` if it's immediately followed by a word starting 'click' Otherwise we advise people about 'float clicking' and other difficult endeavours See http://trac.wxwidgets.org/ticket/16904 --- sphinxtools/utilities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sphinxtools/utilities.py b/sphinxtools/utilities.py index 9ab3c934..9f3afac1 100644 --- a/sphinxtools/utilities.py +++ b/sphinxtools/utilities.py @@ -198,9 +198,10 @@ def ReplaceCppItems(line): :rtype: `string` """ + items = RE_KEEP_SPACES.split(line) newstr = [] - for item in RE_KEEP_SPACES.split(line): + for n, item in enumerate(items): if item in CPP_ITEMS: continue @@ -210,7 +211,8 @@ def ReplaceCppItems(line): elif item == 'char': item = 'int' elif item == 'double': - item = 'float' + if len(items) > n+2 and not items[n+2].lower().startswith("click"): + item = 'float' if len(item.replace('``', '')) > 2: if '*' in item: