def parse_wrmap(wikitext: str) -> dict:
"""Parses the '<wrmap ...>content</wrmap>' of the Winterrodeln wrmap extension.
- If wikitext does not contain the <wrmap> tag or if the <wrmap> tag contains
+ If wikitext does not contain the <wrmap> tag or if the <wrmap> tag contains
invalid formatted lines, a ParseError is raised.
Use wrpylib.mwmarkup.find_tag(wikitext, 'wrmap') to find the wrmap tag within an arbitrary
wikitext before using this function.
wrong_properties = set(feature.attrib.keys()) - allowed_properties
if len(wrong_properties) > 0:
raise ParseError(f"The attribute '{list(wrong_properties)[0]}' is not allowed at <{feature.tag}>.")
- if 'farbe' in feature.attrib:
+ if 'farbe' in feature.attrib:
if not re.match('#[0-9a-fA-F]{6}$', feature.attrib['farbe']):
raise ParseError('The attribute "farbe" has to have a format like "#a0bb43".')
properties['strokeColor'] = feature.attrib['farbe'] # e.g. #a200b7
for coord in coords:
result.append(f'{coord[1]:.6f} N {coord[0]:.6f} E')
return '\n'.join(result)
-
+
def create_wrmap(geojson: Dict) -> str:
"""Creates a <wrmap> wikitext from geojson (as python types)."""