Escape `'s in strings.

Samuel Cassiba's IRC 'sc`' contains a ` which has special meaning in RST
Escape the URL and strings as passed to sphinx to render correctly.

Note: if we discover similarly problematic characters we'll need to create a
more comprehensive escape function.

Change-Id: I4634457b7251ca96fde91b48a09538fccb721374
This commit is contained in:
Tony Breeds 2016-09-13 08:36:12 +10:00 committed by Tristan Cacqueray
parent 78ceff9153
commit 7178c7b1e1

View File

@ -14,6 +14,7 @@
"""
import os
import urllib
from jinja2 import FileSystemLoader
from jinja2.environment import Environment
@ -44,9 +45,10 @@ def build_candidates_list(election=utils.SERIES_NAME):
filepath = os.path.join(project_prefix, candidate_file)
candidates_list.append(
{
'url': '%s/openstack/election/plain/%s' % (utils.CGIT_URL,
filepath),
'ircname': os.path.basename(filepath)[:-4],
'url': ('%s/%s/plain/%s' %
(utils.CGIT_URL, utils.ELECTION_REPO,
urllib.quote_plus(filepath, safe='/'))),
'ircname': candidate_file[:-4].replace('`', r'\`'),
'fullname': utils.get_fullname(filepath)
})