Exemplo n.º 1
0
def render_description(json_content):
    """Escaping ampersand symbol form URIs.

    Arguments:
    JSON_file_path -- path to the JSON file where the ampersand will be be escaped in URIs.
    """
    json_content["description"] = parse_to_markdown(json_content["description"])
Exemplo n.º 2
0
def parse_json_description(JSON_element, links):
    """Search for a 'decription' key in the current object and parse ti as markdown

    Arguments:
    JSON_element -- JSON element to iterate and parse
    links - List of links gathered from the descriptions
    """

    if type(JSON_element) is dict:
        for key in JSON_element:
            if key == "description":
                JSON_element[key] = parse_to_markdown(JSON_element[key])

                for link in get_links_from_description(JSON_element[key]):
                    if link not in links:
                        links.append(link)
                
            else:
                JSON_element[key] = parse_json_description(JSON_element[key], links)

    elif type(JSON_element) is list:
        for key in range(len(JSON_element)):
            JSON_element[key] = parse_json_description(JSON_element[key], links)

    return JSON_element