tools: ceph-release-notes: escape _ for unintended links

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 <http://tracker.ceph.com/issues/17499>`_, `pr#11325 <http://github.com/ceph/ceph/pull/11325>\
`_, weiqiaomiao)
```
and apparently, "RGWGetUsage_" is not a hyper link here.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-07-24 18:16:05 +08:00
parent 7536d2ecae
commit c3607562be

View File

@ -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):