[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: l10n-support/pology/misc
From: Chusslove Illich <caslav.ilic () gmx ! net>
Date: 2008-09-30 21:14:04
Message-ID: 1222809244.855650.6245.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 866442 by ilic:
Better compromise: do not remove ampersand as accelerator marker if in position that \
looks like an XML entity.
M +10 -3 resolve.py
--- trunk/l10n-support/pology/misc/resolve.py #866441:866442
@@ -89,7 +89,7 @@
return entities
-_entity_tail_rx = re.compile(r"^([\w_:][\w\d._:-]*);")
+_entity_tail_rx = re.compile(r"([\w_:][\w\d._:-]*);")
def resolve_entities (text, entities, ignored_entities,
srcname=None, fcap=False,
@@ -617,6 +617,14 @@
break
if text[p + alen:p + alen + 1].isalnum():
+ # If the accelerator marker is &, do not remove it if it
+ # looks like an XML entity (less damage than otherwise).
+ if accel == "&":
+ m = _entity_tail_rx.match(text, p + alen)
+ if m:
+ p = m.span()[1]
+ continue
+
# Valid accelerator.
text = text[:p] + text[p + alen:]
@@ -642,9 +650,8 @@
if text[p + alen:p + 2 * alen] == accel:
# Escaped accelerator marker.
text = text[:p] + text[p + alen:]
+ p += alen
- p += alen
-
return text
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic