Math notation is now correctly applied in callable messages.

parent 61885a11
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment