diff --git a/docs/source/scancode-toolkit/rst_snippets/custom_output_format.rst b/docs/source/scancode-toolkit/rst_snippets/custom_output_format.rst index e3ac7296..8e921dc7 100644 --- a/docs/source/scancode-toolkit/rst_snippets/custom_output_format.rst +++ b/docs/source/scancode-toolkit/rst_snippets/custom_output_format.rst @@ -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 %} @@ -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``: :: @@ -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 `_ +given with Scancode, to generate HTML output with the ``--html`` output format option. + +Documentation on `Jinja templates `_.