diff --git a/src/scancode/format.py b/src/scancode/format.py index 0c3a42ff37c..c5d0fba8d1d 100644 --- a/src/scancode/format.py +++ b/src/scancode/format.py @@ -132,6 +132,8 @@ def as_html(detected_data): template = get_html_template('html') converted = OrderedDict() + converted_infos = OrderedDict() + converted_packages = OrderedDict() licenses = {} # Create a dict keyed by location @@ -158,11 +160,22 @@ def as_html(detected_data): if entry['key'] not in licenses: licenses[entry['key']] = entry - if results: converted[location] = sorted(results, key=itemgetter('start')) + if 'infos' in scan_result: + converted_infos[location] = scan_result['infos'] + + if 'packages' in scan_result: + converted_packages[location] = scan_result['packages'] + licenses = OrderedDict(sorted(licenses.items())) - return template.render(results=converted, licenses=licenses) + results = { + "license_copyright": converted, + "infos": converted_infos, + "packages": converted_packages + } + + return template.render(results=results, licenses=licenses) diff --git a/src/scancode/templates/html/template.html b/src/scancode/templates/html/template.html index 9f89f162cd8..e49e33a3c37 100644 --- a/src/scancode/templates/html/template.html +++ b/src/scancode/templates/html/template.html @@ -64,6 +64,7 @@ + {% if results.license_copyright %} @@ -75,7 +76,7 @@ - {% for location, data in results.items() %} + {% for location, data in results.license_copyright.items() %} {% for row in data %} @@ -92,6 +93,87 @@ {% endfor %}
{{ location }}
+ {% endif %} + + {% if results.infos %} + + + + + + + + + + + + + + + + + + + + + + + + + + {% for location, data in results.infos.items() %} + {% for row in data %} + + + + + + + + + + + + + + + + + + + + + {% endfor %} + {% endfor %} + +
File Information
locationtypenameextensiondatesizesha1md5files_countmime_typefile_typeprogramming_languageis_binaryis_textis_archiveis_mediais_sourceis_script
{{ location }}{{ row.type }}{{ row.name }}{{ row.extension }}{{ row.date }}{{ row.size }}{{ row.sha1 }}{{ row.md5 }}{{ row.file_count }}{{ row.mime_type }}{{ row.file_type }}{{ row.programming_language }}{{ row.is_binary }}{{ row.is_text }}{{ row.is_archive }}{{ row.is_media }}{{ row.is_source }}{{ row.is_script }}
+ {% endif %} + + {% if results.packages %} + + + + + + + + + + + + {% for location, data in results.packages.items() %} + {% for row in data %} + + + + + + + {% endfor %} + {% endfor %} + +
Package Information
locationtypepackagingprimary_language
{{ location }}{{ row.type }}{{ row.packaging }}{{ row.primary_language }}
+ {% endif %} {% if licenses %}