if not match is None: return (float(match.group(2)), float(match.group(1)), None, None)
return RuntimeError(u'Could not parse line ' + line)
- regexp = re.compile(u"(<googlemap[^>]*>)(.*?)(</googlemap>)", re.DOTALL)
- match = regexp.search(wikitext)
- if match is None: return None
- start = match.start()
- end = match.end()
- content = match.group(2)
- gm = xml.etree.ElementTree.XML((match.group(1)+match.group(3)).encode('UTF8'))
+ start, content, endtag, end = find_tag(wikitext, 'googlemap')
+ if content is None:
+ return None
+ gm = xml.etree.ElementTree.XML((wikitext[start:content]+wikitext[endtag:end]).encode('UTF8'))
zoom = gm.get('zoom')
lon = gm.get('lon')
lat = gm.get('lat')
coords = []
paths = []
- lines = content.split("\n")
+ lines = wikitext[content:endtag].split("\n")
i = 0
while i < len(lines):
line = lines[i].strip()