Minors template improvements
If CVE is 'Requested' then it's not used in reporters and mitre reference. Adds wordwrap to notes and errata text. Remove a trailing space. Change-Id: I5c649aea967868ce0726eac9e374f4f4f83d2cb6
This commit is contained in:
@@ -23,7 +23,7 @@ Description
|
||||
|
||||
Errata
|
||||
~~~~~~
|
||||
{{ errata_text }}
|
||||
{{ errata }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ Credits
|
||||
~~~~~~~
|
||||
{% for reporter in reporters %}
|
||||
{% if 'affiliation' in reporter and reporter['affiliation'] and reporter['affiliation'] != 'UNKNOWN' %}
|
||||
- {{ reporter['name'] | trim | indent }} from {{ reporter ['affiliation'] }} ({{ reporter['reported'] | csv_list }})
|
||||
- {{ reporter['name'] | trim | indent }} from {{ reporter ['affiliation'] }}{% if 'reported' in reporter %} ({{ reporter['reported'] | csv_list }}){% endif %}
|
||||
|
||||
{% else %}
|
||||
- {{ reporter['name'] | trim | indent }} ({{ reporter['reported'] | csv_list }})
|
||||
{% endif %}
|
||||
@@ -54,16 +55,16 @@ References
|
||||
{% for link in issues['links'] %}
|
||||
- {{ link }}
|
||||
{% endfor %}
|
||||
{% for vuln in vulnerabilities %}
|
||||
{% for vuln in vulnerabilities %}{% if vuln['cve-id'] != 'Requested' %}
|
||||
- http://cve.mitre.org/cgi-bin/cvename.cgi?name={{ vuln['cve-id'] }}
|
||||
{% endfor %}
|
||||
{% endif %}{% endfor %}
|
||||
{% if notes %}
|
||||
|
||||
|
||||
Notes
|
||||
~~~~~
|
||||
{% for note in notes %}
|
||||
- {{ note }}
|
||||
- {{ note | wordwrap(width=77, break_long_words=False, wrapstring='\n ') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if errata %}
|
||||
|
||||
@@ -29,7 +29,7 @@ def to_snake_case(d):
|
||||
|
||||
def to_paragraphs(d, *args):
|
||||
for k in args:
|
||||
if type(d[k]) == str:
|
||||
if k in d and type(d[k]) == str:
|
||||
d[k] = '\n'.join(textwrap.wrap(d[k]))
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ def render_template(template, data, **kwargs):
|
||||
def render(source, template, **kwargs):
|
||||
vals = yaml.safe_load(open(source).read())
|
||||
to_snake_case(vals)
|
||||
to_paragraphs(vals, 'description')
|
||||
to_paragraphs(vals, 'description', 'errata')
|
||||
return render_template(template, vals, **kwargs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user