from pywikibot.logging import warning
from pywikibot.site._namespace import BuiltinNamespace
-from wrpylib.wrmwmarkup import create_sledrun_wiki, lonlat_to_json, lonlat_ele_to_json
+from wrpylib.wrmwmarkup import create_sledrun_wiki, lonlat_to_json, lonlat_ele_to_json, parse_wrmap
from wrpylib.wrvalidators import rodelbahnbox_from_template, tristate_german_to_str, difficulty_german_to_str, \
- avalanches_german_to_str, public_transport_german_to_str
+ avalanches_german_to_str, public_transport_german_to_str, opt_str_opt_comment_enum_to_str
from pywikibot.site import Namespace
warning(f"{map_json_page.title()} already exists, skipping {self.current_page.title()}.")
return
+ map_json = None
+ v = wikicode.filter_tags(matches='wrmap')
+ if len(v) > 0:
+ map_json = parse_wrmap(str(v[0]))
+
sledrun_json = {
"name": self.current_page.title(),
"aliases": [],
"description": "Holadrio!",
}
- map_json = None
rbb_list = wikicode.filter_templates(recursive=False, matches=lambda t: t.name.strip() == 'Rodelbahnbox')
if len(rbb_list) == 1:
if w is not None:
sledrun_json['nightlight_description'] = w
+ v = rbb['Rodelverleih']
+ if v is not None:
+ sledrun_json['sled_rental_direct'] = v != []
+ sledrun_json['sled_rental_description'] = opt_str_opt_comment_enum_to_str(v)
+
v = rbb['In Übersichtskarte']
if v is not None:
sledrun_json['show_in_overview'] = v
if v != {}:
sledrun_json['bottom'] = v
+ v = rbb['Telefonauskunft']
+ if v is not None:
+ sledrun_json['info_phone'] = [{'phone': p, 'name': n} for p, n in v]
+
v = rbb['Öffentliche Anreise']
if v is not None:
sledrun_json['public_transport'] = public_transport_german_to_str(v)