Example #1
0
def details_overview(entity_name):
    channel_request = request.args.get("channel", default=None, type=str)

    extra_fields = [
        "default-release.revision.readme-md",
        "result.bugs-url",
        "result.website",
        "result.summary",
    ]

    package = get_package(entity_name, channel_request,
                          FIELDS.copy() + extra_fields)

    readme = package["default-release"]["revision"].get(
        "readme-md", "No readme available")

    # Remove Markdown comments
    readme = re.sub("(<!--.*-->)", "", readme, flags=re.DOTALL)

    readme = md_parser(readme)
    readme = decrease_headers(readme)
    return render_template(
        "details/overview.html",
        package=package,
        readme=readme,
        package_type=package["type"],
        channel_requested=channel_request,
    )
Example #2
0
def process_python_docs(library, module_name):
    """Process libraries response from the API
    to generate the HTML output"""

    # Obtain Python docstrings
    docstrings = get_docstrings(library["content"], module_name)

    docstrings["html"] = increase_headers(md_parser(docstrings["docstring"]),
                                          3)

    # We support markdown inside docstrings (2 levels)
    for py_part in docstrings["content"]:
        py_part["html"] = increase_headers(md_parser(py_part["docstring"]), 3)

        for py_part_2 in py_part["content"]:
            py_part_2["html"] = increase_headers(
                md_parser(py_part_2["docstring"]), 3)

    return docstrings
Example #3
0
def process_python_docs(library, module_name):
    """Process libraries response from the API
    to generate the HTML output"""

    # Obtain Python docstrings
    docstrings = get_docstrings(library["content"], module_name)

    docstrings["html"] = decrease_headers(
        md_parser(docstrings["docstring_text"]), 3)

    return docstrings
Example #4
0
def details_overview(entity_name):
    # Get entity info from API
    package = app.store_api.get_item_details(entity_name, fields=FIELDS)
    package = logic.add_store_front_data(package)

    for channel in package["channel-map"]:
        channel["channel"]["released-at"] = logic.convert_date(
            channel["channel"]["released-at"])

    readme = package["default-release"]["revision"]["readme-md"]

    # Remove Markdown comments
    readme = re.sub("(<!--.*-->)", "", readme, flags=re.DOTALL)

    readme = md_parser(readme)
    readme = increase_headers(readme)

    return render_template(
        "details/overview.html",
        package=package,
        readme=readme,
        package_type=package["type"],
    )