fix: [tools] Generate index Markdown layout updated

This commit is contained in:
Alexandre Dulaunoy 2022-01-07 16:55:29 +01:00
parent db9a0dc04d
commit a0804c1194
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -27,11 +27,11 @@ output = ""
for f in galaxies_fnames: for f in galaxies_fnames:
with open(os.path.join(pathClusters, f)) as fr: with open(os.path.join(pathClusters, f)) as fr:
cluster = json.load(fr) cluster = json.load(fr)
output = f'{output}\n# {cluster["name"]}\n\n' output = f'{output}\n## {cluster["name"]}\n\n'
link = cluster["name"].replace(" ", "_").lower() link = cluster["name"].replace(" ", "_").lower()
total = len(cluster["values"]) total = len(cluster["values"])
output = f'{output}[{cluster["name"]}](https://www.misp-project.org/galaxy.html#_{link}) - {cluster["description"]}\n' output = f'{output}[{cluster["name"]}](https://www.misp-project.org/galaxy.html#_{link}) - {cluster["description"]}\n'
output = f'{output}\nCategory: *{cluster["category"]}* - source: *{cluster["source"]}* - total: *{total}* elements \n' output = f'{output}\nCategory: *{cluster["category"]}* - source: *{cluster["source"]}* - total: *{total}* elements\n'
output = f'{output}\n[[HTML](https://www.misp-project.org/galaxy.html#_{link})] - [[JSON](https://github.com/MISP/misp-galaxy/blob/main/clusters/{f})]\n' output = f'{output}\n[[HTML](https://www.misp-project.org/galaxy.html#_{link})] - [[JSON](https://github.com/MISP/misp-galaxy/blob/main/clusters/{f})]\n'
print(output) print(output)