changeset 1879:b43ee22eac98

frontends (tools/strings): fixXHTMLLinks skips internal anchors (links starting with "#") fix bug 126
author souliane <souliane@mailoo.org>
date Sat, 05 Mar 2016 13:58:02 +0100
parents 7a07f232e7cb
children 68944e270c40
files frontends/src/tools/strings.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/tools/strings.py	Fri Mar 04 23:24:06 2016 +0100
+++ b/frontends/src/tools/strings.py	Sat Mar 05 13:58:02 2016 +0100
@@ -84,7 +84,7 @@
     for match in re.finditer(r'<a( \w+="[^"]*")* ?/?>', xhtml):
         tag = match.group(0)
         url = re.search(r'href="([^"]*)"', tag)
-        if url:
+        if url and not url.group(1).startswith("#"):  # skip internal anchor
             if not re.search(r'target="([^"]*)"', tag):  # no target
                 subs.append((tag, '<a target="_blank"%s' % tag[2:]))
             if not re.match(r"^\w+://", url.group(1)):  # no scheme