Przeglądaj źródła

Math notation is now correctly applied in callable messages.

Sander Mathijs van Veen 13 lat temu
rodzic
commit
9874fec07a
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      src/possibilities.py

+ 3 - 3
src/possibilities.py

@@ -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)