|
| 1 | +Custom HTML Output Available Data |
| 2 | +--------------------------------- |
| 3 | + |
| 4 | +When using the ``--custom-template`` option, a files dictionary is passed |
| 5 | +to Jinja2 for output generation. |
| 6 | +This dictionary contains three keys: ``license_copyright``, ``infos``, and |
| 7 | +``package_data`` — each of which is also a dictionary. |
| 8 | + |
| 9 | +If you want to access these data, you will need to do something like the following: |
| 10 | + |
| 11 | +:: |
| 12 | + |
| 13 | + {% if files.license_copyright %} |
| 14 | + ... |
| 15 | + {% if files.infos %} |
| 16 | + ... |
| 17 | + {% if files.package_data %} |
| 18 | + |
| 19 | + |
| 20 | +``license_copyright`` is a dictionary where each key is a file path, and |
| 21 | +each value is a list of dictionaries. Each dictionary in the list contains |
| 22 | +four keys: ``start``, ``end``, ``what``, and ``value``. |
| 23 | + |
| 24 | + |
| 25 | + * ``start`` is the start line from the detection |
| 26 | + * ``end`` is the end line from the detection |
| 27 | + * ``what`` can be either "copyright" or "license" |
| 28 | + * ``value`` is the value of the detected copyright or licnese expression |
| 29 | + |
| 30 | + |
| 31 | +``infos`` is a dictionary where each key is a file path, and |
| 32 | +each value is either a list of dictionaries or a string. |
| 33 | + |
| 34 | +The following is a list of dictionary keys from ``infos`` whose values are strings: |
| 35 | + |
| 36 | +:: |
| 37 | + |
| 38 | + type |
| 39 | + name |
| 40 | + extension |
| 41 | + date |
| 42 | + size |
| 43 | + sha1 |
| 44 | + md5 |
| 45 | + file_count |
| 46 | + mime_type |
| 47 | + file_type |
| 48 | + programming_language |
| 49 | + is_binary |
| 50 | + is_text |
| 51 | + is_archive |
| 52 | + is_media |
| 53 | + is_source |
| 54 | + is_script |
| 55 | + |
| 56 | + |
| 57 | +The following is a list of dictionary keys from ``infos`` whose values are lists of dictionaries: |
| 58 | + |
| 59 | +:: |
| 60 | + |
| 61 | + holders - It is a list of dictionaries, each containing the keys: ``holder``, ``start_line``, and ``end_line`` |
| 62 | + authors - It is a list of dictionaries, each containing the keys: ``author``, ``start_line``, and ``end_line`` |
| 63 | + emails - It is a list of dictionaries, each containing the keys: ``email``, ``start_line``, and ``end_line`` |
| 64 | + urls - It is a list of dictionaries, each containing the keys: ``url``, ``start_line``, and ``end_line`` |
| 65 | + |
| 66 | + |
| 67 | +``package_data`` is a dictionary where each key is a file path, and |
| 68 | +each value is a list of dictionaries. Each dictionary in the list contains |
| 69 | +three keys: ``type``, ``packaging``, and ``primary_language``. |
| 70 | + |
| 71 | + |
| 72 | +Additionally, a ``license_reference`` list is also provided for output generation. |
| 73 | +It is a list of dicionaries with the following keys and value structure: |
| 74 | + |
| 75 | +:: |
| 76 | + |
| 77 | + key - string |
| 78 | + short_name - string |
| 79 | + category - string |
| 80 | + owner - string |
| 81 | + scancode_url - string |
| 82 | + licensedb_url - string |
| 83 | + homepage_url - string |
| 84 | + text_urls - list |
| 85 | + spdx_license_key - string |
| 86 | + spdx_url - string |
| 87 | + |
0 commit comments