]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: ceph-release-notes: escape _ for unintended links
authorKefu Chai <kchai@redhat.com>
Mon, 24 Jul 2017 10:16:05 +0000 (18:16 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 24 Jul 2017 10:18:24 +0000 (18:18 +0800)
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>
src/script/ceph-release-notes

index 2148ed3f1ccdf8151ce6e501453fa9879f5bce95..3a3da4e71ebb8a455094027e789555a26e0f0094 100755 (executable)
@@ -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):