update data and templates
This commit is contained in:
		@ -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)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user