diff options
| author | Georg Brandl <georg@python.org> | 2010-03-01 14:36:08 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-03-01 14:36:08 +0100 |
| commit | 63c040fcc26d9693a627e88d894562c26630ffa8 (patch) | |
| tree | 0ee773a794d0f1a72bd3536eece455389df61797 | |
| parent | 21484180255bef33f7c3d15caa8592b8345087c4 (diff) | |
| download | sphinx-63c040fcc26d9693a627e88d894562c26630ffa8.tar.gz | |
Allow escaping "<" in x-ref roles by a backslash.
| -rw-r--r-- | sphinx/roles.py | 4 | ||||
| -rw-r--r-- | sphinx/util/nodes.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/roles.py b/sphinx/roles.py index d20898ff..50c76df1 100644 --- a/sphinx/roles.py +++ b/sphinx/roles.py @@ -105,9 +105,9 @@ class XRefRole(object): else: domain, role = typ.split(':', 1) classes = ['xref', domain, '%s-%s' % (domain, role)] - text = utils.unescape(text) # if the first character is a bang, don't cross-reference at all if text[0:1] == '!': + text = utils.unescape(text) if self.fix_parens: text, tgt = self._fix_parens(env, False, text[1:], "") innernode = self.innernodeclass(rawtext, text, classes=classes) @@ -115,6 +115,8 @@ class XRefRole(object): is_ref=False) # split title and target in role content has_explicit_title, title, target = split_explicit_title(text) + title = utils.unescape(title) + text = utils.unescape(text) # fix-up title and target if self.lowercase: target = target.lower() diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index 13fa3c10..04185436 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -17,7 +17,8 @@ from docutils import nodes from sphinx import addnodes -explicit_title_re = re.compile('^(.+?)\s*<(.*?)>$', re.DOTALL) +# \x00 means the "<" was backslash-escaped +explicit_title_re = re.compile(r'^(.+?)\s*(?<!\x00)<(.*?)>$', re.DOTALL) caption_ref_re = explicit_title_re # b/w compat alias |
