update data and templates

This commit is contained in:
2022-11-23 11:22:03 +01:00
parent b5439711d6
commit 7c55f348e8
3 changed files with 46 additions and 16 deletions

View File

@ -1,4 +1,5 @@
import copy
import re
import otc_metadata.services
from ruamel.yaml import YAML
@ -10,17 +11,15 @@ new_data = data._service_data
for doc in new_data["documents"]:
hc_location = None
if "type" in doc:
if doc["type"] == "api-ref":
hc_location = "api"
elif doc["type"] == "umn":
hc_location = "usermanual"
elif doc["type"] == "dev":
hc_location = "devg"
if hc_location:
hc_location += f"/{doc['service_type']}"
doc["hc_location"] = hc_location
link = doc.get("link")
if link:
print(f"Parsing {link}")
#(p1, p2) = link.split("/")
doc["link"] = re.sub(
r"/(.*)/(.*)/",
r"/\2/\1/",
link
)
_yaml = YAML()
_yaml.indent(mapping=2, sequence=4, offset=2)