Skip to content
Snippets Groups Projects
Commit 0909acea authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Esacpe strings such as |Q| in property descriptions

Docutils interprets these as references by default but we just want plain
.text
parent 158137bd
No related branches found
No related tags found
No related merge requests found
#pylint: disable=invalid-name
from mantiddoc.directives.base import AlgorithmBaseDirective
import re
import string
SUBSTITUTE_REF_RE = re.compile(r'\|(.+?)\|')
class PropertiesDirective(AlgorithmBaseDirective):
"""
......@@ -239,7 +242,16 @@ class PropertiesDirective(AlgorithmBaseDirective):
allowedValueString = allowedValueString.replace("','","', '")
desc += prefixString + allowedValueString
return desc
return self._escape_subsitution_refs(desc)
def _escape_subsitution_refs(self, desc):
"""
Find occurrences of text surrounded by vertical bars and assume they
are not docutils subsitution referencess by esacping them
"""
def repl(match):
return '\|' + match.group(1) + '\|'
return SUBSTITUTE_REF_RE.sub(repl, desc)
def setup(app):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment