Skip to content

Commit 75a744f

Browse files
sritasnghavinal
andcommitted
Add emails and urls
Add emails and urls in converted_infos. Add holders, authors, emails and urls information in html template. Signed-off-by: Sarita Singh <[email protected]> Co-authored-by: Avinal Kumar <[email protected]>
1 parent daeb709 commit 75a744f

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

src/formattedcode/output_html.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ def generate_output(results, version, template):
155155
LICENSES = 'licenses'
156156
COPYRIGHTS = 'copyrights'
157157
PACKAGES = 'packages'
158-
URLS = 'urls'
159-
EMAILS = 'emails'
160158

161159
# Create a flattened data dict keyed by path
162160
for scanned_file in results:
@@ -197,7 +195,7 @@ def generate_output(results, version, template):
197195
# denormalizing the list here??
198196
converted_infos[path] = {}
199197
for name, value in scanned_file.items():
200-
if name in (LICENSES, PACKAGES, COPYRIGHTS, EMAILS, URLS):
198+
if name in (LICENSES, PACKAGES, COPYRIGHTS):
201199
continue
202200
converted_infos[path][name] = value
203201

src/formattedcode/templates/html/template.html

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,106 @@
131131
{% endfor %}
132132
</tbody>
133133
</table>
134+
<table>
135+
<caption>Holders</caption>
136+
<thead>
137+
<tr>
138+
<th>path</th>
139+
<th>holder</th>
140+
<th>start</th>
141+
<th>end</th>
142+
</tr>
143+
</thead>
144+
<tbody>
145+
{% for path, row in files.infos.items() %}
146+
{% if row.holders %}
147+
{% for data in row.holders %}
148+
<tr>
149+
<td>{{ path }}</td>
150+
<td>{{ data.value }}</td>
151+
<td>{{ data.start_line }}</td>
152+
<td>{{ data.end_line }}</td>
153+
</tr>
154+
{% endfor %}
155+
{% endif %}
156+
{% endfor %}
157+
</tbody>
158+
</table>
159+
<table>
160+
<caption>Authors</caption>
161+
<thead>
162+
<tr>
163+
<th>path</th>
164+
<th>Author</th>
165+
<th>start</th>
166+
<th>end</th>
167+
</tr>
168+
</thead>
169+
<tbody>
170+
{% for path, row in files.infos.items() %}
171+
{% if row.authors %}
172+
{% for data in row.authors %}
173+
<tr>
174+
<td>{{ path }}</td>
175+
<td>{{ data.value }}</td>
176+
<td>{{ data.start_line }}</td>
177+
<td>{{ data.end_line }}</td>
178+
</tr>
179+
{% endfor %}
180+
{% endif %}
181+
{% endfor %}
182+
</tbody>
183+
</table>
184+
<table>
185+
<caption>Emails</caption>
186+
<thead>
187+
<tr>
188+
<th>path</th>
189+
<th>email</th>
190+
<th>start</th>
191+
<th>end</th>
192+
</tr>
193+
</thead>
194+
<tbody>
195+
{% for path, row in files.infos.items() %}
196+
{% if row.emails %}
197+
{% for data in row.emails %}
198+
<tr>
199+
<td>{{ path }}</td>
200+
<td>{{ data.email |urlize(target='_blank') }}</td>
201+
<td>{{ data.start_line }}</td>
202+
<td>{{ data.end_line }}</td>
203+
</tr>
204+
{% endfor %}
205+
{% endif %}
206+
{% endfor %}
207+
</tbody>
208+
</table>
209+
<table>
210+
<caption>Urls</caption>
211+
<thead>
212+
<tr>
213+
<th>path</th>
214+
<th>url</th>
215+
<th>start</th>
216+
<th>end</th>
217+
</tr>
218+
</thead>
219+
<tbody>
220+
{% for path, row in files.infos.items() %}
221+
{% if row.urls %}
222+
{% for data in row.urls %}
223+
<tr>
224+
<td>{{ path }}</td>
225+
<td>{{ data.url |urlize(target='_blank') }}</td>
226+
<td>{{ data.start_line }}</td>
227+
<td>{{ data.end_line }}</td>
228+
</tr>
229+
{% endfor %}
230+
{% endif %}
231+
{% endfor %}
232+
</tbody>
233+
</table>
134234
{% endif %}
135235

136236
{% if files.packages %}

0 commit comments

Comments
 (0)