#!/usr/bin/python3.4
-# -*- coding: iso-8859-15 -*-
# $Id$
# $HeadURL$
"""This module contains winterrodeln specific functions that are processing the MediaWiki markup.
# 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.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.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.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.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.cachet = cachet_german_to_str(value['Gütesiegel'])
sledrun.information_web = webauskunft_to_str(value['Webauskunft'])
sledrun.information_phone = opt_phone_comment_enum_to_str(value['Telefonauskunft'])
sledrun.image = value['Bild']
- sledrun.show_in_overview = value['In Übersichtskarte']
+ 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
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['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['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['Ö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'] = lift_german_from_str(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['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['In Übersichtskarte'] = sledrun.show_in_overview
value['Forumid'] = sledrun.forum_id
return value
"""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.position_elevation = value['Höhe']
inn.operator = value['Betreiber']
- inn.seats = value['Sitzplätze']
- inn.overnight, inn.overnight_comment = value['Übernachtung']
+ 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']
"""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['Höhe'] = inn.position_elevation
value['Betreiber'] = inn.operator
- value['Sitzplätze'] = inn.seats
- value['Übernachtung'] = (inn.overnight, inn.overnight_comment)
+ 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
def find_template_Hoehenunterschied(wikitext):
- """Same as find_template_unsigned with template '{{Höhenunterschied|350}}'"""
- return find_template_unsigned(wikitext, 'Höhenunterschied')
+ """Same as find_template_unsigned with template '{{Höhenunterschied|350}}'"""
+ return find_template_unsigned(wikitext, 'Höhenunterschied')
def create_template_Hoehenunterschied(ele_diff):
- return create_template_unsigned('Höhenunterschied', ele_diff)
+ return create_template_unsigned('Höhenunterschied', ele_diff)
def find_template_Bahnlaenge(wikitext):
- """Same as find_template_unsigned with template '{{Bahnlänge|4500}}'"""
- return find_template_unsigned(wikitext, 'Bahnlänge')
+ """Same as find_template_unsigned with template '{{Bahnlänge|4500}}'"""
+ return find_template_unsigned(wikitext, 'Bahnlänge')
def create_template_Bahnlaenge(length):
- return create_template_unsigned('Bahnlänge', length)
+ return create_template_unsigned('Bahnlänge', length)
def find_template_Gehzeit(wikitext):
if start is None: return (None,) * 3
title, params = wrpylib.mwmarkup.split_template(wikitext[start:end])
forumid = params['1'].strip()
- if forumid == '<nummer einfügen>': unsigned_value = None
+ if forumid == '<nummer einfügen>': unsigned_value = None
else: unsigned_value = wrpylib.wrvalidators.UnsignedNone().to_python(forumid)
return start, end, unsigned_value
# return find_template_unsigned(wikitext, u'Forumlink')
wikitext = u'''
<wrmap lat="47.2417134" lon="11.21408895" zoom="14" width="700" height="400">
- <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
+ <gasthaus name="Rosskogelhütte" wiki="Rosskogelhütte">47.240689 11.190454</gasthaus>
<parkplatz>47.245789 11.238971</parkplatz>
- <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
+ <haltestelle name="Oberperfuss Rangger Köpfl Lift">47.245711 11.238283</haltestelle>
<rodelbahn>
47.238587 11.203360
47.244951 11.230868
if last_json_feature is not None:
last_json_feature.tail = '\n\n'
return xml.etree.ElementTree.tostring(wrmap_xml, encoding='utf-8').decode('utf-8')
-