From 25aa05d26ec6f57c8458f079687b430d015a4246 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 11 Jan 2021 13:57:02 +0100 Subject: [PATCH] devtools: Make the raw changelog more readable The links were rather annoying in the flowing text, so extract them and add them to the footer of the release instead. This uses the shorthand and footnote style of links. --- devtools/changelog.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/devtools/changelog.py b/devtools/changelog.py index c28b306f0..e61b754a2 100755 --- a/devtools/changelog.py +++ b/devtools/changelog.py @@ -23,6 +23,7 @@ sections = [ repo = 'ElementsProject/lightning' Entry = namedtuple("Entry", ["commit", "pullreq", "content", "section"]) +Link = namedtuple("Link", ["ref", "content", "url"]) def git(cmd): @@ -75,6 +76,17 @@ def get_log_entries(commitrange): return entries +def linkify(entries): + links = [] + for e in entries: + links.append(Link( + ref='#{}'.format(e.pullreq), + content=e.content, + url="https://github.com/ElementsProject/lightning/pull/{}".format(e.pullreq) + )) + return list(set(links)) + + def group(entries): groups = {s: [] for s in sections} for e in entries: @@ -92,7 +104,12 @@ def commit_date(commitsha): template = Template("""<%def name="group(entries)"> % for e in entries: - - ${e.content} ([${e.pullreq}](https://github.com/ElementsProject/lightning/pull/${e.pullreq})) + - ${e.content} ([#${e.pullreq}]) +% endfor + +<%def name="group_links(entries)"> +% for e in entries: +[${e.pullreq}]: https://github.com/ElementsProject/lightning/pull/${e.pullreq} % endfor