ceph-release-notes: Support for markdown for new ceph.io site

Signed-off-by: David Galloway <dgallowa@redhat.com>
This commit is contained in:
David Galloway 2021-06-30 13:11:06 -04:00
parent 849de7c98c
commit 8497f4b1d6

View File

@ -140,7 +140,7 @@ def _title_message(commit, pr, strict):
message = " " + "\n ".join(lines)
return (title, message)
def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags):
def make_release_notes(gh, repo, ref, plaintext, html, markdown, verbose, strict, use_tags):
issue2prs = {}
pr2issues = {}
@ -252,6 +252,11 @@ def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags
'<a href="http://tracker.ceph.com/issues/{issue}">issue#{issue}</a>'
).format(issue=issue), pr2issues[pr]
)
elif markdown:
issues = map(lambda issue: (
'[issue#{issue}](http://tracker.ceph.com/issues/{issue})'
).format(issue=issue), pr2issues[pr]
)
else:
issues = map(lambda issue: (
'`issue#{issue} <http://tracker.ceph.com/issues/{issue}>`_'
@ -279,6 +284,13 @@ def make_release_notes(gh, repo, ref, plaintext, html, verbose, strict, use_tags
author=author, pr=pr
)
)
elif markdown:
print ("- {title} ({issues}[pr#{pr}](https://github.com/ceph/ceph/pull/{pr}), {author})\n".format(
title=title,
issues=issues,
author=author, pr=pr
)
)
else:
print (
(
@ -318,7 +330,10 @@ if __name__ == "__main__":
help="output plain text only, no links")
parser.add_argument("--html",
action='store_true', default=None,
help="output html format for website blog")
help="output html format for (old wordpress) website blog")
parser.add_argument("--markdown",
action='store_true', default=None,
help="output markdown format for new ceph.io blog")
parser.add_argument("--verbose", "-v",
action='store_true', default=None,
help="verbose")
@ -345,6 +360,7 @@ if __name__ == "__main__":
args.rev,
args.text,
args.html,
args.markdown,
args.verbose,
args.strict,
args.use_tags