]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/blobdiff - bots/sledrun_wikitext_to_json.py
Move some functions to lib_sledrun_wikitext_to_json.py
[philipp/winterrodeln/wrpylib.git] / bots / sledrun_wikitext_to_json.py
index 60bcb21af06737812de403b6241e831dcd1946f6..72880cd5eb677848a61df9b0457ab95f41788b3b 100644 (file)
@@ -38,35 +38,12 @@ from wrpylib.wrmwmarkup import create_sledrun_wiki, lonlat_to_json, lonlat_ele_t
 from wrpylib.wrvalidators import rodelbahnbox_from_template, tristate_german_to_str, difficulty_german_to_str, \
     avalanches_german_to_str, public_transport_german_to_str, opt_lonlat_from_str, \
     opt_uint_from_str
-from wrpylib.lib_sledrun_wikitext_to_json import optional_set, get_sledrun_description
+from wrpylib.lib_sledrun_wikitext_to_json import optional_set, get_sledrun_description, wikilink_to_json, \
+    template_to_json, external_link_to_json
 
 docuReplacements = {'&params;': pagegenerators.parameterHelp}
 
 
-def template_to_json(value: Template) -> dict:
-    parameter = []
-    for p in value.params:
-        parameter.append({'value': str(p)})
-    return {
-        'name': str(value.name),
-        'parameter': parameter
-    }
-
-
-def wikilink_to_json(value: Wikilink) -> dict:
-    wl = {'title': str(value.title)}
-    if value.text is not None:
-        wl['text'] = str(value.text)
-    return wl
-
-
-def external_link_to_json(value: ExternalLink) -> dict:
-    link = {'url': str(value.url)}
-    if value.title is not None:
-        link['text'] = str(value.title)
-    return link
-
-
 class SledrunWikiTextToJsonBot(
     SingleSiteBot,
     ConfigParserBot,