From ccc924ffb31a591ac752b68d731de67c9120075a Mon Sep 17 00:00:00 2001 From: Sen Hastings Date: Wed, 3 Aug 2022 10:33:24 -0500 Subject: [PATCH] support/scripts/pkg-stats: add linebreak opportunity in CPE ID This adds an optional linebreak at the vendor attribute in the CPE ID. It should be noted this is purely for formatting/layout purposes and does not actually insert any additional characters (newline or otherwise) into the rendered text. This means that even though the text renders across two lines, copy-pasting will still yield one line of text. example: https://sen-h.github.io/pkg-stats/c245575.html see also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr Signed-off-by: Sen Hastings Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-stats | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 91d42206ca..d32abd7225 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -1102,7 +1102,9 @@ def dump_html_pkg(f, pkg): div_class.append("cpe-unknown") f.write(f'
\n') if pkg.cpeid: - f.write(" %s\n" % pkg.cpeid) + cpeid_begin = ":".join(pkg.cpeid.split(":")[0:4]) + ":" + cpeid_formatted = pkg.cpeid.replace(cpeid_begin, cpeid_begin + "") + f.write(" %s\n" % cpeid_formatted) if not pkg.is_status_ok("cpe"): if pkg.is_actual_package and pkg.current_version: if pkg.cpeid: