From bee6edc6a834c6f81a6f243376afab60da0f1c0a Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Fri, 22 Jun 2018 12:56:26 +0200 Subject: [PATCH] fix: cleanup the link generation based on type instead of title (Thanks to Juan Rocha for the report) --- tools/adoc_galaxy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/adoc_galaxy.py b/tools/adoc_galaxy.py index 490bcbd..bb01508 100644 --- a/tools/adoc_galaxy.py +++ b/tools/adoc_galaxy.py @@ -67,14 +67,14 @@ def header(adoc=False): doc = doc + "= MISP galaxy\n" return doc -def asciidoc(content=False, adoc=None, t='title',title=''): +def asciidoc(content=False, adoc=None, t='title',title='', typename=''): adoc = adoc + "\n" output = "" if t == 'title': output = '== ' + content elif t == 'info': - output = "\n{}.\n\n{} {} {}{}.json[*this location*] {}.\n".format(content, 'NOTE: ', title, 'is a cluster galaxy available in JSON format at https://github.com/MISP/misp-galaxy/blob/master/clusters/',title.lower(),' The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP]') + output = "\n{}.\n\n{} {} {}$${}$$.json[*this location*] {}.\n".format(content, 'NOTE: ', title, 'is a cluster galaxy available in JSON format at https://github.com/MISP/misp-galaxy/blob/master/clusters/',typename.lower(),' The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP]') elif t == 'author': output = '\nauthors:: {}\n'.format(' - '.join(content)) elif t == 'value': @@ -102,8 +102,9 @@ for cluster in clusters: with open(fullPathClusters) as fp: c = json.load(fp) title = c['name'] + typename = c['type'] adoc = asciidoc(content=title, adoc=adoc, t='title') - adoc = asciidoc(content=c['description'], adoc=adoc, t='info', title=title) + adoc = asciidoc(content=c['description'], adoc=adoc, t='info', title=title, typename = typename) if 'authors' in c: adoc = asciidoc(content=c['authors'], adoc=adoc, t='author', title=title) for v in c['values']: