From: David Galloway Date: Thu, 17 Dec 2020 01:13:57 +0000 (-0500) Subject: script/ceph-release-notes: --html flag to output PRs in HTML X-Git-Tag: v17.0.0~30^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b939d5beba20c0fd797caade22ab8306b27148e2;p=ceph.git 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 --- 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