From b939d5beba20c0fd797caade22ab8306b27148e2 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 16 Dec 2020 20:13:57 -0500 Subject: [PATCH] script/ceph-release-notes: --html flag to output PRs in HTML This will probably only be useful until the new website is done but it'll save me hours. Signed-off-by: David Galloway --- src/script/ceph-release-notes | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 244cb46c7ff1..c0a7b059a302 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -137,7 +137,7 @@ def _title_message(commit, pr, strict): message = " " + "\n ".join(lines) return (title, message) -def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags): +def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags): issue2prs = {} pr2issues = {} @@ -227,6 +227,11 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags): if pr in pr2issues: if plaintext: issues = map(lambda issue: '#' + str(issue), pr2issues[pr]) + elif html: + issues = map(lambda issue: ( + 'issue#{issue}' + ).format(issue=issue), pr2issues[pr] + ) else: issues = map(lambda issue: ( '`issue#{issue} `_' @@ -242,6 +247,18 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags): author=author.encode("utf-8") ) ) + elif html: + print ( + ( + "
  • {title} ({issues}pr#{pr}, {author})

  • " + ).format( + title=title.encode("utf-8"), + issues=issues, + author=author.encode("utf-8"), pr=pr + ) + ) else: print ( ( @@ -279,6 +296,9 @@ if __name__ == "__main__": parser.add_argument("--text", "-t", action='store_true', default=None, help="output plain text only, no links") + parser.add_argument("--html", + action='store_true', default=None, + help="output html format for website blog") parser.add_argument("--verbose", "-v", action='store_true', default=None, help="verbose") @@ -304,6 +324,7 @@ if __name__ == "__main__": Repo(args.repo), args.rev, args.text, + args.html, args.verbose, args.strict, args.use_tags -- 2.47.3