From 7178c7b1e16873fbe5ea0ef6fe3ff8183e94fdbb Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 13 Sep 2016 08:36:12 +1000 Subject: [PATCH] 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 --- doc/source/_exts/candidates.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/source/_exts/candidates.py b/doc/source/_exts/candidates.py index 9511a0d9..7087dba6 100644 --- a/doc/source/_exts/candidates.py +++ b/doc/source/_exts/candidates.py @@ -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) })