Skip to content
Snippets Groups Projects
Commit 9874fec0 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen
Browse files

Math notation is now correctly applied in callable messages.

parent 61885a11
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,9 @@ class Possibility(object):
if self.handler in MESSAGES:
msg = MESSAGES[self.handler]
if callable(msg):
msg = msg(self.root, self.args)
# Surround math notation with backticks. If there are any backticks
# already, do not add additional backticks. The add_backticks
# lambda is necessary otherwise because \1 and \2 are not matched
......@@ -26,9 +29,6 @@ class Possibility(object):
add_backticks = lambda x: '`%s`' % ''.join(x.groups(''))
msg = re.sub('`([^`]*)`|\(?({[^. ]+)', add_backticks, msg)
if callable(msg):
msg = msg(self.root, self.args)
return msg.format(self.root, *self.args)
return repr(self)
......
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