From c3607562be6043fc9e56af01b7641cdc69531db1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 24 Jul 2017 18:16:05 +0800 Subject: [PATCH] tools: ceph-release-notes: escape _ for unintended links MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit foobar_ is taken as a hyper link by RST. so escape the underscores. this change can avoid the warnings like: ceph/doc/release-notes.rst:4593: ERROR: Unknown target name: "rgwgetusage". where the source code looks like: ``` rgw: need to 'open_object_section' before dump stats in 'RGWGetUsage_…(`issue#17499 `_, `pr#11325 \ `_, weiqiaomiao) ``` and apparently, "RGWGetUsage_" is not a hyper link here. Signed-off-by: Kefu Chai --- src/script/ceph-release-notes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 2148ed3f1cc..3a3da4e71eb 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -49,6 +49,7 @@ prefixes = ['bluestore', 'build/ops', 'cephfs', 'cephx', 'cli', 'cmake', 'rbd', 'rbd-mirror', 'rbd-nbd', 'rgw', 'tests', 'tools'] signed_off_re = re.compile("Signed-off-by: (.+) <") tracker_re = re.compile("http://tracker.ceph.com/issues/(\d+)") +rst_link_re = re.compile(r"([a-zA-Z0-9])_(\W)") tracker_uri = "http://tracker.ceph.com/issues/{0}.json" @@ -201,6 +202,8 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags): # escape asterisks, which is used by reStructuredTextrst for inline # emphasis title = title.replace('*', '\*') + # and escape the underscores for noting a link + title = rst_link_re.sub(r'\1\_\2', title) pr2info[number] = (author, title, message) for issue in set(issues): -- 2.39.5