# Refill wrmappointcache and wrmappathcache tables
for sledrun_page in sledrun_pages:
- try:
- start, content, endtag, end = mwmarkup.find_tag(sledrun_page.old_text, 'wrmap')
- if content is None:
- continue
- geojson = wrmwmarkup.parse_wrmap(sledrun_page.old_text[start:end])
+ try:
+ import mwparserfromhell
+ wikicode = mwparserfromhell.parse(sledrun_page.old_text)
+ wrmap_list = wikicode.filter_tags(recursive=False, matches=lambda tag: tag.tag == 'wrmap')
+ if len(wrmap_list) == 0:
+ continue # not wrmap in page
+ if len(wrmap_list) > 1:
+ raise UpdateCacheError('{} <wrmap ...> entries found in article "{}"'.format(len(wrmap_list), sledrun_page.page_title))
+ wrmap = wrmap_list[0]
+ geojson = wrmwmarkup.parse_wrmap(str(wrmap))
for feature in geojson['features']:
properties = feature['properties']