def htmlData()

in functions/source/table-generator-lambda.py [0:0]


def htmlData(current_file, col):
    tables = ''
    html_prefix = u'<!DOCTYPE HTML><html lang="en-US"><head><meta charset="UTF-8">' + u' <link rel="stylesheet" href="https://s3.amazonaws.com/aws-cfn-samples/quickstart-cfn-param-table-generator/resources/styles.css">'
    html_doc_data = '</head><body>{}</body></html>'

    template_raw_data = getTemplateText(current_file)

    if template_raw_data == "ERROR":
        error_message = "Error occurred retrieving file {}. <br/> Please make sure it is a valid http(s) url or s3 uri." \
                        "<br/> The http(s) url must be publicly reachable." \
                        "<br/> For s3 uri, you must supply the bucket name as the TemplatesBucket parameter during deployment." \
                        "<br/> See Lambda CloudWatch logs for details.".format(current_file)
        return html_prefix + html_doc_data.format(error_message).replace("\n"," ")

    # print(template_raw_data)

    yaml = YAML()
    yaml.preserve_quotes = True
    template_data = yaml.load(template_raw_data)

    has_parameters = hasParameters(template_data)
    has_interface = hasInterface(template_data)

    if has_parameters:
        tables = tables + "<h1>" + current_file + "</h1>\n"

        if has_interface:
            tables += buildGroupedTable(template_data, col)
        else:
            print("No metadata section. That is no parameter groups and labels")
            tables += buildSimpleTable(template_data)

        tables += '<br/>'
    else:
        print("No parameters section in current file.")

    html_doc_data = html_doc_data.format(tables).replace("\n"," ")
    html_doc_data = html_prefix + html_doc_data

    return html_doc_data