- for v in wikicode.get_sections(levels=[2], matches='Anreise mit dem Auto'):
- for w in v.ifilter_text(recursive=False):
- x = w.strip()
- if x:
- sledrun_json["car_description"] = str(x)
- break
- x = []
- for w in v.ifilter_templates(matches='Parkplatz'):
- za = str_or_none(w.get(1, None))
- zb = str_or_none(w.get(2, None))
- z = lonlat_ele_to_json(opt_lonlat_from_str(za), opt_uint_from_str(zb))
- if len(z) > 0:
- x.append({'position': z})
- if len(x) > 0:
- sledrun_json['car_parking'] = x
-
- x = []
- for w in io.StringIO(str(v)):
- match = re.match(r"\*\* von \'\'\'(.+)\'\'\'(.*): ([\d.,]+) km", w.rstrip())
- if match:
- ya, yb, yc = match.groups()
- yc = float(yc.replace(',', '.'))
- x.append({
- 'km': yc,
- 'route': (ya.strip() + ' ' + yb.strip()).strip(),
- })
- if len(x) > 0:
- sledrun_json['car_distances'] = x
-
- x = []
- for v in wikicode.get_sections(levels=[2], matches='Allgemeines'):
- def _gastronomy(value: str):
- gastronomy = []
- line_iter = io.StringIO(value)
+ def _car():
+ for v in wikicode.get_sections(levels=[2], matches='Anreise mit dem Auto'):
+ for w in v.ifilter_text(recursive=False):
+ x = w.strip()
+ if x:
+ sledrun_json["car_description"] = str(x)
+ break
+ x = []
+ for w in v.ifilter_templates(matches='Parkplatz'):
+ za = str_or_none(w.get(1, None))
+ zb = str_or_none(w.get(2, None))
+ z = lonlat_ele_to_json(opt_lonlat_from_str(za), opt_uint_from_str(zb))
+ if len(z) > 0:
+ x.append({'position': z})
+ if len(x) > 0:
+ sledrun_json['car_parking'] = x
+
+ x = []
+ for w in io.StringIO(str(v)):
+ match = re.match(r"\*\* von \'\'\'(.+)\'\'\'(.*): ([\d.,]+) km", w.rstrip())
+ if match:
+ ya, yb, yc = match.groups()
+ yc = float(yc.replace(',', '.'))
+ x.append({
+ 'km': yc,
+ 'route': (ya.strip() + ' ' + yb.strip()).strip(),
+ })
+ if len(x) > 0:
+ sledrun_json['car_distances'] = x
+ _car()
+
+ x = []
+ for v in wikicode.get_sections(levels=[2], matches='Allgemeines'):
+ def _gastronomy(value: str):
+ gastronomy = []
+ line_iter = io.StringIO(value)
+ line = next(line_iter, None)
+ while line is not None and line.rstrip() != "* '''Hütten''':":