Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ data for this particular scan.

## template.html:
[
{% if results.license_copyright %}
{% for location, data in results.license_copyright.items() %}
{% if files.license_copyright %}
{% for location, data in files.license_copyright.items() %}
{% for row in data %}
location:"{{ location }}",
{% if row.what == 'copyright' %}copyright:"{{ row.value|escape }}",{% endif %}
Expand All @@ -36,12 +36,12 @@ Now I can run ScanCode using my newly created template:

::

$ ./scancode -clpeui --custom-output sample.json --custom-template sample.html samples
$ ./scancode -clpeui --custom-output output.json --custom-template template.html samples
Scanning files...
[####################################] 46
Scanning done.

Now are results are saved in ``t.json`` and we can easily view them with ``head t.json``\ :
Now are results are saved in ``output.json`` and we can easily view them with ``head output.json``:

::

Expand All @@ -53,8 +53,7 @@ Now are results are saved in ``t.json`` and we can easily view them with ``head
copyright:"copyrighted by the Free Software Foundation",
]

..
[ToDo]
There is an error in the template.html file:
"UndefinedError: 'results' is undefined"
Will be solved in a later commit.
For a more elaborate template, refer this `default template <https://github.com/nexB/scancode-toolkit/blob/develop/src/formattedcode/templates/html/template.html>`_
given with Scancode, to generate HTML output with the ``--html`` output format option.

Documentation on `Jinja templates <https://jinja.palletsprojects.com/en/2.10.x/>`_.