import collections
import textwrap
import unittest
+import mwparserfromhell
import wrpylib.mwmarkup
-import wrpylib.wrmwmarkup
+from wrpylib.wrmwmarkup import *
+
+
+class TestSledrun(unittest.TestCase):
+ def test_sledrun_from_rodelbahnbox(self):
+ class Sledrun:
+ pass
+ rodelbahnbox = collections.OrderedDict([
+ ('Position', LonLat(9.986508, 47.30982)),
+ ('Position oben', LonLat(None, None)),
+ ('Höhe oben', 1244),
+ ('Position unten', LonLat(8.506047, 46.20210)),
+ ('Höhe unten', None),
+ ('Länge', 5045),
+ ('Schwierigkeit', 3),
+ ('Lawinen', 2),
+ ('Betreiber', 'SchneeFunFit'),
+ ('Öffentliche Anreise', 2),
+ ('Aufstieg möglich', True),
+ ('Aufstieg getrennt', (0.0, None)),
+ ('Gehzeit', 105),
+ ('Aufstiegshilfe', [('Sessellift', 'gratis'), ('Bus', None)]),
+ ('Beleuchtungsanlage', (0.0, 'in Planung für 2020')),
+ ('Beleuchtungstage', (None, None)),
+ ('Rodelverleih', []),
+ ('Gütesiegel', []),
+ ('Webauskunft', 'http://example.com/schneelage'),
+ ('Telefonauskunft', [('+43-664-1808482', 'Bergkristallhütte')]),
+ ('Bild', 'Rodelbahn Bergkristallhütte 2009-03-03.jpg'),
+ ('In Übersichtskarte', True),
+ ('Forumid', 72)])
+ sledrun = Sledrun()
+ sledrun_from_rodelbahnbox(rodelbahnbox, sledrun)
+ self.assertEqual(47.30982, sledrun.position_latitude)
+ self.assertEqual(9.986508, sledrun.position_longitude)
+ self.assertEqual(None, sledrun.top_latitude)
+ self.assertEqual(None, sledrun.top_longitude)
+ self.assertEqual(1244, sledrun.top_elevation)
+ self.assertEqual(46.20210, sledrun.bottom_latitude)
+ self.assertEqual(8.506047, sledrun.bottom_longitude)
+ self.assertEqual(None, sledrun.bottom_elevation)
+ self.assertEqual(5045, sledrun.length)
+ self.assertEqual(3, sledrun.difficulty)
+ self.assertEqual(2, sledrun.avalanches)
+ self.assertEqual('SchneeFunFit', sledrun.operator)
+ self.assertEqual(2, sledrun.public_transport)
+ self.assertEqual(True, sledrun.walkup_possible)
+ self.assertEqual(105, sledrun.walkup_time)
+ self.assertEqual(0.0, sledrun.walkup_separate)
+ self.assertEqual(None, sledrun.walkup_separate_comment)
+ self.assertEqual(True, sledrun.lift)
+ self.assertEqual('Sessellift (gratis); Bus', sledrun.lift_details)
+ self.assertEqual(0.0, sledrun.night_light)
+ self.assertEqual('in Planung für 2020', sledrun.night_light_comment)
+ self.assertEqual(None, sledrun.night_light_days)
+ self.assertEqual(None, sledrun.night_light_days_comment)
+ self.assertEqual(False, sledrun.sled_rental)
+ self.assertEqual('Nein', sledrun.sled_rental_comment)
+ self.assertEqual('Nein', sledrun.cachet)
+ self.assertEqual('http://example.com/schneelage', sledrun.information_web)
+ self.assertEqual('+43-664-1808482 (Bergkristallhütte)', sledrun.information_phone)
+ self.assertEqual('Rodelbahn Bergkristallhütte 2009-03-03.jpg', sledrun.image)
+ self.assertEqual(True, sledrun.show_in_overview)
+ self.assertEqual(72, sledrun.forum_id)
+
+ def test_sledrun_to_rodelbahnbox(self):
+ class Sledrun:
+ pass
+ sledrun = Sledrun() # TODO: populate for test
+ rodelbahnbox = sledrun_to_rodelbahnbox(sledrun)
+ # TODO: check result
+
+
+class TestInn(unittest.TestCase):
+ def test_inn_from_gasthausbox(self):
+ class Inn:
+ pass
+ gasthausbox = [] # TODO: populate for test
+ inn = Inn()
+ inn_from_gasthausbox(gasthausbox, inn)
+ # TODO: check result
+
+ def test_inn_to_gasthausbox(self):
+ class Inn:
+ pass
+ inn = Inn() # TODO: populate for test
+ gasthausbox = inn_to_gasthausbox(inn)
+ # TODO: check result
+
+
+class TestLonlatEle(unittest.TestCase):
+ def test_lonlat_ele_from_template(self):
+ template = mwparserfromhell.parse('{{Position oben|46.942239 N 11.468819 E|1866}}').filter_templates()[0]
+ lonlat, ele = lonlat_ele_from_template(template)
+ self.assertEqual(LonLat(11.468819, 46.942239), lonlat)
+ self.assertEqual(1866, ele)
+
+ def test_latlon_ele_to_template(self):
+ template = latlon_ele_to_template((LonLat(11.468819, 46.942239), 1866), 'Position oben')
+ self.assertEqual('{{Position oben|46.942239 N 11.468819 E|1866}}', template)
class TestWrMwMarkup(unittest.TestCase):
def test_RodelbahnboxDictConverter(self):
v = wrpylib.wrmwmarkup.RodelbahnboxDictConverter()
- other = collections.OrderedDict([
- ('Position', (47.30982, 9.986508)),
- ('Position oben', (None, None)),
- ('Höhe oben', 1244),
- ('Position unten', (None, None)),
- ('Höhe unten', 806),
- ('Länge', 5045),
- ('Schwierigkeit', None),
- ('Lawinen', 3),
- ('Betreiber', None),
- ('Öffentliche Anreise', 6),
- ('Aufstieg möglich', True),
- ('Aufstieg getrennt', (0.0, None)),
- ('Gehzeit', 105),
- ('Aufstiegshilfe', (False, None)),
- ('Beleuchtungsanlage', (0.0, None)),
- ('Beleuchtungstage', (None, None)),
- ('Rodelverleih', (True, 'Ja')),
- ('Gütesiegel', None),
- ('Webauskunft', None),
- ('Telefonauskunft', '+43-664-1808482 (Bergkristallhütte)'),
- ('Bild', 'Rodelbahn Bergkristallhütte 2009-03-03.jpg'),
- ('In Übersichtskarte', True),
- ('Forumid', 72)])
+
sledrun = v.to_python(other)
assert sledrun.forum_id == 72
other2 = v.from_python(sledrun)
import re
import xml.etree.ElementTree
import collections
-import formencode
+import mwparserfromhell
import wrpylib.wrvalidators
import wrpylib.mwmarkup
+import wrpylib.wrmwdb
+from wrpylib.wrvalidators import LonLat, opt_lonlat_from_str, opt_lonlat_to_str, opt_uint_from_str, opt_uint_to_str, \
+ opt_str_opt_comment_enum_to_str, lift_german_to_str, webauskunft_to_str, cachet_german_to_str
+
+
+def sledrun_from_rodelbahnbox(value, sledrun):
+ """Takes a Rodelbahnbox as returned by rodelbahnbox_from_str (that is, an OrderedDict) and
+ updates the sledrun instance with all values present in the Rodelbahnbox. Other values are not
+ updated. Does not validate the arguments."""
+ # sledrun.page_id = None # this field is not updated because it is not present in the RodelbahnBox
+ # sledrun.page_title = None # this field is not updated because it is not present in the RodelbahnBox
+ # sledrun.name_url = None # this field is not updated because it is not present in the RodelbahnBox
+ sledrun.position_longitude, sledrun.position_latitude = value['Position']
+ sledrun.top_longitude, sledrun.top_latitude = value['Position oben']
+ sledrun.top_elevation = value['Höhe oben']
+ sledrun.bottom_longitude, sledrun.bottom_latitude = value['Position unten']
+ sledrun.bottom_elevation = value['Höhe unten']
+ sledrun.length = value['Länge']
+ sledrun.difficulty = value['Schwierigkeit']
+ sledrun.avalanches = value['Lawinen']
+ sledrun.operator = value['Betreiber']
+ sledrun.public_transport = value['Öffentliche Anreise']
+ sledrun.walkup_possible = value['Aufstieg möglich']
+ sledrun.walkup_time = value['Gehzeit']
+ sledrun.walkup_separate, sledrun.walkup_separate_comment = value['Aufstieg getrennt']
+ sledrun.lift = None if value['Aufstiegshilfe'] is None else len(value['Aufstiegshilfe']) > 0
+ sledrun.lift_details = lift_german_to_str(value['Aufstiegshilfe'])
+ sledrun.night_light, sledrun.night_light_comment = value['Beleuchtungsanlage']
+ sledrun.night_light_days, sledrun.night_light_days_comment = value['Beleuchtungstage']
+ sledrun.sled_rental = None if value['Rodelverleih'] is None else len(value['Rodelverleih']) > 0
+ sledrun.sled_rental_comment = opt_str_opt_comment_enum_to_str(value['Rodelverleih'])
+ sledrun.cachet = cachet_german_to_str(value['Gütesiegel'])
+ sledrun.information_web = webauskunft_to_str(value['Webauskunft'])
+ sledrun.information_phone = value['Telefonauskunft']
+ sledrun.image = value['Bild']
+ sledrun.show_in_overview = value['In Übersichtskarte']
+ sledrun.forum_id = value['Forumid']
+ # sledrun.under_construction = None # this field is not updated because it is not present in the RodelbahnBox
+ return sledrun
+
+
+def sledrun_to_rodelbahnbox(sledrun):
+ value = collections.OrderedDict()
+ value['Position'] = LonLat(sledrun.position_longitude, sledrun.position_latitude)
+ value['Position oben'] = LonLat(sledrun.top_longitude, sledrun.top_latitude)
+ value['Höhe oben'] = sledrun.top_elevation
+ value['Position unten'] = LonLat(sledrun.bottom_longitude, sledrun.bottom_latitude)
+ value['Höhe unten'] = sledrun.bottom_elevation
+ value['Länge'] = sledrun.length
+ value['Schwierigkeit'] = sledrun.difficulty
+ value['Lawinen'] = sledrun.avalanches
+ value['Betreiber'] = sledrun.operator
+ value['Öffentliche Anreise'] = sledrun.public_transport
+ value['Aufstieg möglich'] = sledrun.walkup_possible
+ value['Gehzeit'] = sledrun.walkup_time
+ value['Aufstieg getrennt'] = sledrun.walkup_separate, sledrun.walkup_separate_comment
+ value['Aufstiegshilfe'] = sledrun.lift, sledrun.lift_details
+ value['Beleuchtungsanlage'] = sledrun.night_light, sledrun.night_light_comment
+ value['Beleuchtungstage'] = sledrun.night_light_days, sledrun.night_light_days_comment
+ value['Rodelverleih'] = sledrun.sled_rental, sledrun.sled_rental_comment
+ value['Gütesiegel'] = sledrun.cachet
+ value['Webauskunft'] = sledrun.information_web
+ value['Telefonauskunft'] = sledrun.information_phone
+ value['Bild'] = sledrun.image
+ value['In Übersichtskarte'] = sledrun.show_in_overview
+ value['Forumid'] = sledrun.forum_id
+ return value
+
+
+def inn_from_gasthausbox(value, inn):
+ """Converts a dict with Gasthausbox properties to a Inn class. Does no validation.
+ value is a dict of properties as returned by gasthausbox_from_str."""
+ inn.position_longitude, inn.position_latitude = value['Position']
+ inn.position_elevation = value['Höhe']
+ inn.operator = value['Betreiber']
+ inn.seats = value['Sitzplätze']
+ inn.overnight, inn.overnight_comment = value['Übernachtung']
+ inn.nonsmoker_area, inn.smoker_area = value['Rauchfrei']
+ inn.sled_rental, inn.sled_rental_comment = value['Rodelverleih']
+ inn.mobile_provider = value['Handyempfang']
+ inn.homepage = value['Homepage']
+ inn.email_list = value['E-Mail']
+ inn.phone_list = value['Telefon']
+ inn.image = value['Bild']
+ inn.sledding_list = value['Rodelbahnen']
+ return inn
-WRMAP_POINT_TYPES = ['gasthaus', 'haltestelle', 'parkplatz', 'achtung', 'foto', 'verleih', 'punkt']
-WRMAP_LINE_TYPES = ['rodelbahn', 'gehweg', 'alternative', 'lift', 'anfahrt', 'linie']
+
+def inn_to_gasthausbox(inn):
+ """Converts an inn class to a dict of Gasthausbox properties. value is an Inn instance."""
+ value = collections.OrderedDict()
+ value['Position'] = LonLat(inn.position_longitude, inn.position_latitude)
+ value['Höhe'] = inn.position_elevation
+ value['Betreiber'] = inn.operator
+ value['Sitzplätze'] = inn.seats
+ value['Übernachtung'] = (inn.overnight, inn.overnight_comment)
+ value['Rauchfrei'] = (inn.nonsmoker_area, inn.smoker_area)
+ value['Rodelverleih'] = (inn.sled_rental, inn.sled_rental_comment)
+ value['Handyempfang'] = inn.mobile_provider
+ value['Homepage'] = inn.homepage
+ value['E-Mail'] = inn.email_list
+ value['Telefon'] = inn.phone_list
+ value['Bild'] = inn.image
+ value['Rodelbahnen'] = inn.sledding_list
+ return value
+
+
+def lonlat_ele_from_template(template):
+ """Template is a mwparserfromhell.nodes.template.Template instance. Returns (lonlat, ele)."""
+ lonlat = opt_lonlat_from_str(template.params[0].strip())
+ ele = opt_uint_from_str(template.params[1].strip())
+ return lonlat, ele
+
+
+def latlon_ele_to_template(lonlat_ele, name):
+ lonlat, ele = lonlat_ele
+ template = mwparserfromhell.nodes.template.Template(name)
+ template.add(1, opt_lonlat_to_str(lonlat))
+ template.add(2, opt_uint_to_str(ele))
+ wrpylib.mwmarkup.format_template_oneline(template)
+ return template
class ParseError(RuntimeError):
pass
-class RodelbahnboxDictConverter(formencode.Validator):
- """Converts a dict with Rodelbahnbox properties to a Sledrun class. Does no validation."""
-
- def to_python(self, value, state=None):
- """value is a dict of properties. If state is an object with the attribute sledrun, this sledrun class will be populated or updated."""
- props = value
- if isinstance(state, object) and hasattr(state, 'sledrun'):
- sledrun = state.sledrun
- else:
- class Sledrun(object):
- pass
- sledrun = Sledrun()
- for k, v in props.items():
- if k == 'Position': sledrun.position_latitude, sledrun.position_longitude = v
- elif k == 'Position oben': sledrun.top_latitude, sledrun.top_longitude = v
- elif k == 'Höhe oben': sledrun.top_elevation = v
- elif k == 'Position unten': sledrun.bottom_latitude, sledrun.bottom_longitude = v
- elif k == 'Höhe unten': sledrun.bottom_elevation = v
- elif k == 'Länge': sledrun.length = v
- elif k == 'Schwierigkeit': sledrun.difficulty = v
- elif k == 'Lawinen': sledrun.avalanches = v
- elif k == 'Betreiber': sledrun.operator = v
- elif k == 'Öffentliche Anreise': sledrun.public_transport = v
- elif k == 'Aufstieg möglich': sledrun.walkup_possible = v
- elif k == 'Aufstieg getrennt': sledrun.walkup_separate, sledrun.walkup_separate_comment = v
- elif k == 'Gehzeit': sledrun.walkup_time = v
- elif k == 'Aufstiegshilfe': sledrun.lift, sledrun.lift_details = v
- elif k == 'Beleuchtungsanlage': sledrun.night_light, sledrun.night_light_comment = v
- elif k == 'Beleuchtungstage': sledrun.night_light_days, sledrun.night_light_days_comment = v
- elif k == 'Rodelverleih': sledrun.sled_rental, sledrun.sled_rental_comment = v
- elif k == 'Gütesiegel': sledrun.cachet = v
- elif k == 'Webauskunft': sledrun.information_web = v
- elif k == 'Telefonauskunft': sledrun.information_phone = v
- elif k == 'Bild': sledrun.image = v
- elif k == 'In Übersichtskarte': sledrun.show_in_overview = v
- elif k == 'Forumid': sledrun.forum_id = v
- return sledrun
-
- def from_python(self, value, state=None):
- """Converts a sledrun class to a dict of Rodelbahnbox properties. value is a sledrun instance."""
- sledrun = value
- r = collections.OrderedDict()
- r['Position'] = (sledrun.position_latitude, sledrun.position_longitude)
- r['Position oben'] = (sledrun.top_latitude, sledrun.top_longitude)
- r['Höhe oben'] = sledrun.top_elevation
- r['Position unten'] = (sledrun.bottom_latitude, sledrun.bottom_longitude)
- r['Höhe unten'] = sledrun.bottom_elevation
- r['Länge'] = sledrun.length
- r['Schwierigkeit'] = sledrun.difficulty
- r['Lawinen'] = sledrun.avalanches
- r['Betreiber'] = sledrun.operator
- r['Öffentliche Anreise'] = sledrun.public_transport
- r['Aufstieg möglich'] = sledrun.walkup_possible
- r['Aufstieg getrennt'] = (sledrun.walkup_separate, sledrun.walkup_separate_comment)
- r['Gehzeit'] = sledrun.walkup_time
- r['Aufstiegshilfe'] = (sledrun.lift, sledrun.lift_details)
- r['Beleuchtungsanlage'] = (sledrun.night_light, sledrun.night_light_comment)
- r['Beleuchtungstage'] = (sledrun.night_light_days, sledrun.night_light_days_comment)
- r['Rodelverleih'] = (sledrun.sled_rental, sledrun.sled_rental_comment)
- r['Gütesiegel'] = sledrun.cachet
- r['Webauskunft'] = sledrun.information_web
- r['Telefonauskunft'] = sledrun.information_phone
- r['Bild'] = sledrun.image
- r['In Übersichtskarte'] = sledrun.show_in_overview
- r['Forumid'] = sledrun.forum_id
- return r
-
-
-class WinterrodelnTemplateDict(formencode.Validator):
- """Private helper class for RodelbahnboxValidator or GasthausboxValidator"""
- def __init__(self, template_title):
- self.template_title = template_title
-
- def to_python(self, value, state):
- title, anonym_params, named_params = value
- if title != self.template_title:
- raise formencode.Invalid('Template title has to be "{}".'.format(self.template_title), value, state)
- if len(anonym_params) > 0:
- raise formencode.Invalid('No anonymous parameters are allowed in "{}".'.format(self.template_title), value, state)
- return named_params
-
- def from_python(self, value, state):
- return self.template_title, [], value
-
-
-class RodelbahnboxValidator(wrpylib.wrvalidators.RodelbahnboxDictValidator):
- def __init__(self):
- wrpylib.wrvalidators.RodelbahnboxDictValidator.__init__(self)
- self.pre_validators=[wrpylib.mwmarkup.TemplateValidator(as_table=True, as_table_keylen=20), WinterrodelnTemplateDict('Rodelbahnbox')]
- self.chained_validators = [RodelbahnboxDictConverter()]
-
-
-def rodelbahnbox_to_sledrun(wikitext, sledrun=None):
- """Converts a sledrun wiki page containing the {{Rodelbahnbox}}
- to a sledrun. sledrun may be an instance of WrSledrunCache or an "empty" class (object()) (default).
- Raises a formencode.Invalid exception if the format is not OK or the Rodelbahnbox is not found.
- :return: (start, end, sledrun) tuple of the Rodelbahnbox."""
- # find Rodelbahnbox
- start, end = wrpylib.mwmarkup.find_template(wikitext, 'Rodelbahnbox')
- if start is None: raise formencode.Invalid("Rodelbahnbox nicht gefunden", wikitext, None)
-
- # convert to sledrun
- if sledrun is None:
- state = None
- else:
- class State(object):
- pass
- state = State()
- state.sledrun = sledrun
- return start, end, RodelbahnboxValidator().to_python(wikitext[start:end], state)
-
-
-def sledrun_to_rodelbahnbox(sledrun, version=None):
- """Converts a sledrun class to the {{Rodelbahnbox}} representation.
- The sledrun class has to have properties like position_latitude, ...
- See the table sledruncache for field (column) values.
- :param sledrun: an arbitrary class that contains the right properties
- :param version: a string specifying the version of the rodelbahnbox zu produce.
- Version '1.4' is supported."""
- assert version in [None, '1.4']
- return RodelbahnboxValidator().from_python(sledrun)
-
-
-class GasthausboxDictConverter(formencode.Validator):
- """Converts a dict with Gasthausbox properties to a Inn class. Does no validation."""
-
- def to_python(self, value, state=None):
- """value is a dict of properties. If state is an object with the attribute inn, this inn class will be populated or updated."""
- props = value
- if isinstance(state, object) and hasattr(state, 'inn'):
- inn = state.inn
- else:
- class Inn(object):
- pass
- inn = Inn()
- for k, v in props.items():
- if k == 'Position': inn.position_latitude, inn.position_longitude = v
- elif k == 'Höhe': inn.position_elevation = v
- elif k == 'Betreiber': inn.operator = v
- elif k == 'Sitzplätze': inn.seats = v
- elif k == 'Übernachtung': inn.overnight, inn.overnight_comment = v
- elif k == 'Rauchfrei': inn.nonsmoker_area, inn.smoker_area = v
- elif k == 'Rodelverleih': inn.sled_rental, inn.sled_rental_comment = v
- elif k == 'Handyempfang': inn.mobile_provider = v
- elif k == 'Homepage': inn.homepage = v
- elif k == 'E-Mail': inn.email_list = v
- elif k == 'Telefon': inn.phone_list = v
- elif k == 'Bild': inn.image = v
- elif k == 'Rodelbahnen': inn.sledding_list = v
- return inn
-
- def from_python(self, value, state=None):
- """Converts an inn class to a dict of Gasthausbox properties. value is an Inn instance."""
- inn = value
- r = collections.OrderedDict()
- r['Position'] = (inn.position_latitude, inn.position_longitude)
- r['Höhe'] = inn.position_elevation
- r['Betreiber'] = inn.operator
- r['Sitzplätze'] = inn.seats
- r['Übernachtung'] = (inn.overnight, inn.overnight_comment)
- r['Rauchfrei'] = (inn.nonsmoker_area, inn.smoker_area)
- r['Rodelverleih'] = (inn.sled_rental, inn.sled_rental_comment)
- r['Handyempfang'] = inn.mobile_provider
- r['Homepage'] = inn.homepage
- r['E-Mail'] = inn.email_list
- r['Telefon'] = inn.phone_list
- r['Bild'] = inn.image
- r['Rodelbahnen'] = inn.sledding_list
- return r
-
-
-class GasthausboxValidator(wrpylib.wrvalidators.GasthausboxDictValidator):
- def __init__(self):
- wrpylib.wrvalidators.GasthausboxDictValidator.__init__(self)
- self.pre_validators=[wrpylib.mwmarkup.TemplateValidator(as_table=True, as_table_keylen=17), WinterrodelnTemplateDict('Gasthausbox')]
- self.chained_validators = [GasthausboxDictConverter()]
-
-
-def gasthausbox_to_inn(wikitext, inn=None):
- """Converts a inn wiki page containing a {{Gasthausbox}} to an inn.
- inn may be an instance of WrInnCache or an "empty" class (default).
- raises a formencode.Invalid exception if the format is not OK or the Gasthausbox is not found.
- :return: (start, end, inn) tuple."""
- # find Gasthausbox
- start, end = wrpylib.mwmarkup.find_template(wikitext, 'Gasthausbox')
- if start is None: raise formencode.Invalid("No 'Gasthausbox' found", wikitext, None)
-
- # convert to inn
- if inn is None:
- state = None
- else:
- class State(object):
- pass
- state = State()
- state.inn = inn
- return start, end, GasthausboxValidator().to_python(wikitext[start:end], state)
-
-
-def inn_to_gasthausbox(inn):
- """Converts the inn class to the {{Gasthausbox}} representation."""
- return GasthausboxValidator().from_python(inn)
-
-
-def split_template_latlon_ele(template):
- """Template is a mwparserfromhell.nodes.template.Template instance. Returns (latlon, ele)."""
- latlon = opt_geostr_to_lat_lon(template.params[1].strip())
- ele = opt_intstr_to_int(template.params[2].strip())
- return latlon, ele
-
-
-def create_template_latlon_ele(template_name, latlon, ele):
- geo = wrpylib.wrvalidators.GeoNone().from_python((latlon))
- if len(geo) == 0: geo = ' '
- ele = wrpylib.wrvalidators.UnsignedNone().from_python(ele)
- if len(ele) == 0: ele = ' '
- return wrpylib.mwmarkup.create_template(template_name, [geo, ele])
-
def find_template_PositionOben(wikitext):
"""Same as find_template_latlon_ele with template '{{Position oben|47.076207 N 11.453553 E|1890}}'"""
raise RuntimeError('Wrong coordinate format: {}'.format(coords))
+WRMAP_POINT_TYPES = ['gasthaus', 'haltestelle', 'parkplatz', 'achtung', 'foto', 'verleih', 'punkt']
+WRMAP_LINE_TYPES = ['rodelbahn', 'gehweg', 'alternative', 'lift', 'anfahrt', 'linie']
+
+
def parse_wrmap(wikitext):
"""Parses the (unicode) u'<wrmap ...>content</wrmap>' of the Winterrodeln wrmap extension.
If wikitext does not contain the <wrmap> tag or if the <wrmap> tag contains