From ff3acfe13adce745b457c6c3c3e6a01ea0a64e52 Mon Sep 17 00:00:00 2001 From: Sen Hastings Date: Wed, 27 Jul 2022 10:41:13 -0500 Subject: [PATCH] support/scripts/pkg-stats: fixed numeral in beginning of CSS class CSS classes are generated for each package name for sorting purposes, However some package names start with a number and this is not allowed. (see https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier) Fix is to prepend a character to every class name such as "_". so every ".package" is now "._package". Signed-off-by: Sen Hastings Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-stats | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index b2a8ddd446..0fba7953c9 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -879,12 +879,12 @@ def boolean_str(b): def dump_html_pkg(f, pkg): - f.write(f'
{pkg.path}
\n') + f.write(f'
{pkg.path}
\n') # Patch count - data_field_id = f'patch_count_{pkg.name}' + data_field_id = f'patch_count__{pkg.name}' div_class = ["centered patch_count data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.patch_count == 0: div_class.append("nopatches") elif pkg.patch_count < 5: @@ -895,10 +895,10 @@ def dump_html_pkg(f, pkg): \">{str(pkg.patch_count)}\n') # Infrastructure - data_field_id = f'infrastructure_{pkg.name}' + data_field_id = f'infrastructure__{pkg.name}' infra = infra_str(pkg.infras) div_class = ["centered infrastructure data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if infra == "Unknown": div_class.append("wrong") else: @@ -907,9 +907,9 @@ def dump_html_pkg(f, pkg): \">{infra_str(pkg.infras)}\n') # License - data_field_id = f'license_{pkg.name}' + data_field_id = f'license__{pkg.name}' div_class = ["centered license data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.is_status_ok('license'): div_class.append("correct") else: @@ -918,9 +918,9 @@ def dump_html_pkg(f, pkg): \">{boolean_str(pkg.is_status_ok("license"))}\n') # License files - data_field_id = f'license_files_{pkg.name}' + data_field_id = f'license_files__{pkg.name}' div_class = ["centered license_files data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.is_status_ok('license-files'): div_class.append("correct") else: @@ -929,9 +929,9 @@ def dump_html_pkg(f, pkg): \">{boolean_str(pkg.is_status_ok("license-files"))}\n') # Hash - data_field_id = f'hash_file_{pkg.name}' + data_field_id = f'hash_file__{pkg.name}' div_class = ["centered hash_file data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.is_status_ok('hash'): div_class.append("correct") else: @@ -940,7 +940,7 @@ def dump_html_pkg(f, pkg): \">{boolean_str(pkg.is_status_ok("hash"))}\n') # Current version - data_field_id = f'current_version_{pkg.name}' + data_field_id = f'current_version__{pkg.name}' if len(pkg.current_version) > 20: current_version = pkg.current_version[:20] + "..." else: @@ -949,8 +949,8 @@ def dump_html_pkg(f, pkg): class=\"centered current_version data {pkg.name}\">{current_version}\n') # Latest version - data_field_id = f'latest_version_{pkg.name}' - div_class.append(pkg.name) + data_field_id = f'latest_version__{pkg.name}' + div_class.append(f'_{pkg.name}') div_class.append("latest_version data") if pkg.latest_version['status'] == RM_API_STATUS_ERROR: div_class.append("version-error") @@ -982,9 +982,9 @@ def dump_html_pkg(f, pkg): f.write(f'
{latest_version_text}
\n') # Warnings - data_field_id = f'warnings_{pkg.name}' + data_field_id = f'warnings__{pkg.name}' div_class = ["centered warnings data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.warnings == 0: div_class.append("correct") else: @@ -992,9 +992,9 @@ def dump_html_pkg(f, pkg): f.write(f'
{pkg.warnings}
\n') # URL status - data_field_id = f'upstream_url_{pkg.name}' + data_field_id = f'upstream_url__{pkg.name}' div_class = ["centered upstream_url data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') url_str = pkg.status['url'][1] if pkg.status['url'][0] in ("error", "warning"): div_class.append("missing_url") @@ -1007,9 +1007,9 @@ def dump_html_pkg(f, pkg): f.write(f'
{url_str}
\n') # CVEs - data_field_id = f'cves_{pkg.name}' + data_field_id = f'cves__{pkg.name}' div_class = ["centered cves data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.is_status_ok("cve"): div_class.append("cve-ok") elif pkg.is_status_error("cve"): @@ -1031,9 +1031,9 @@ def dump_html_pkg(f, pkg): f.write(" \n") # CVEs Ignored - data_field_id = f'ignored_cves_{pkg.name}' + data_field_id = f'ignored_cves__{pkg.name}' div_class = ["centered data ignored_cves"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.ignored_cves: div_class.append("cve_ignored") f.write(f'
\n') @@ -1042,9 +1042,9 @@ def dump_html_pkg(f, pkg): f.write("
\n") # CPE ID - data_field_id = f'cpe_id_{pkg.name}' + data_field_id = f'cpe_id__{pkg.name}' div_class = ["left cpe_id data"] - div_class.append(pkg.name) + div_class.append(f'_{pkg.name}') if pkg.is_status_ok("cpe"): div_class.append("cpe-ok") elif pkg.is_status_error("cpe"):