From 5e6b50b1d9bc1b6d756574424d84144ee0ef5f40 Mon Sep 17 00:00:00 2001 From: Lydia Scarf Date: Fri, 14 Jun 2024 09:59:55 -0400 Subject: [PATCH] Exposure category, quantity_kind should display Wasn't handling multiple categories; also quantity_kind file was misnamed --- _data/schemas/rdl-02.yml | 2 +- _includes/display/exposure_category.html | 14 +++++++++++--- _includes/display/quality_kind.html | 6 ------ _includes/display/quantity_kind.html | 13 +++++++++++++ 4 files changed, 25 insertions(+), 10 deletions(-) delete mode 100644 _includes/display/quality_kind.html create mode 100644 _includes/display/quantity_kind.html diff --git a/_data/schemas/rdl-02.yml b/_data/schemas/rdl-02.yml index ca937ce84..a9a77cb8f 100644 --- a/_data/schemas/rdl-02.yml +++ b/_data/schemas/rdl-02.yml @@ -182,7 +182,7 @@ exposure: - others - field_name: quantity_kind label: Metric Quantity Kind - display_template: display/quality_kind.html + display_template: display/quantity_kind.html # VulnerabilityModel vulnerability: diff --git a/_includes/display/exposure_category.html b/_includes/display/exposure_category.html index 4d1093073..92e3d3f49 100644 --- a/_includes/display/exposure_category.html +++ b/_includes/display/exposure_category.html @@ -1,6 +1,14 @@ {{ include.field.label }} - {% capture code %}{{ include.value }}{% endcapture %} - {{ site.data.rdl-exposure_category[code] }} - \ No newline at end of file + {% assign split_string = include.value | split: ", " %} + {% if split_string[0] %} + {% for code in split_string %} + {{ site.data.rdl-exposure_category[code] }}{% unless forloop.last or site.data.rdl-exposure_category[code] == nil %}, {% endunless %} + {% endfor %} + {% else %} + {% capture code %}{{ include.value }}{% endcapture %} + {{ site.data.rdl-exposure_category[code] }} + {% endif %} + + \ No newline at end of file diff --git a/_includes/display/quality_kind.html b/_includes/display/quality_kind.html deleted file mode 100644 index 35ef40e2c..000000000 --- a/_includes/display/quality_kind.html +++ /dev/null @@ -1,6 +0,0 @@ - - {{ include.field.label }} - - {% capture code %}{{ include.value }}{% endcapture %} - {{ site.data.rdl-quantity_kind[code] }} - \ No newline at end of file diff --git a/_includes/display/quantity_kind.html b/_includes/display/quantity_kind.html new file mode 100644 index 000000000..48d2b4fff --- /dev/null +++ b/_includes/display/quantity_kind.html @@ -0,0 +1,13 @@ + + {{ include.field.label }} + + {% assign split_string = include.value | split: ", " %} + {% if split_string[0] %} + {% for code in split_string %} + {{ site.data.rdl-quantity_kind[code] }}{% unless forloop.last or site.data.rdl-quantity_kind[code] == nil %}, {% endunless %} + {% endfor %} + {% else %} + {% capture code %}{{ include.value }}{% endcapture %} + {{ site.data.rdl-quantity_kind[code] }} + {% endif %} + \ No newline at end of file