Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
9874fec0
Commit
9874fec0
authored
May 24, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Math notation is now correctly applied in callable messages.
parent
61885a11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/possibilities.py
src/possibilities.py
+3
-3
No files found.
src/possibilities.py
View file @
9874fec0
...
@@ -19,6 +19,9 @@ class Possibility(object):
...
@@ -19,6 +19,9 @@ class Possibility(object):
if
self
.
handler
in
MESSAGES
:
if
self
.
handler
in
MESSAGES
:
msg
=
MESSAGES
[
self
.
handler
]
msg
=
MESSAGES
[
self
.
handler
]
if
callable
(
msg
):
msg
=
msg
(
self
.
root
,
self
.
args
)
# Surround math notation with backticks. If there are any backticks
# Surround math notation with backticks. If there are any backticks
# already, do not add additional backticks. The add_backticks
# already, do not add additional backticks. The add_backticks
# lambda is necessary otherwise because \1 and \2 are not matched
# lambda is necessary otherwise because \1 and \2 are not matched
...
@@ -26,9 +29,6 @@ class Possibility(object):
...
@@ -26,9 +29,6 @@ class Possibility(object):
add_backticks
=
lambda
x
:
'`%s`'
%
''
.
join
(
x
.
groups
(
''
))
add_backticks
=
lambda
x
:
'`%s`'
%
''
.
join
(
x
.
groups
(
''
))
msg
=
re
.
sub
(
'`([^`]*)`|
\
(?({[^. ]+)
'
, add_backticks, msg)
msg
=
re
.
sub
(
'`([^`]*)`|
\
(?({[^. ]+)
'
, add_backticks, msg)
if callable(msg):
msg = msg(self.root, self.args)
return msg.format(self.root, *self.args)
return msg.format(self.root, *self.args)
return repr(self)
return repr(self)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment