mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +01:00
Expose standardSubstitute's var dictionary
So it can be reused by plugins if they want to use a different templating engine.
This commit is contained in:
parent
8fe517f48a
commit
406369d53f
@ -943,8 +943,12 @@ for (k, v) in list(mircColors.items()):
|
||||
mircColors[sv] = sv
|
||||
mircColors[sv.zfill(2)] = sv
|
||||
|
||||
def standardSubstitute(irc, msg, text, env=None):
|
||||
"""Do the standard set of substitutions on text, and return it"""
|
||||
|
||||
def standardSubstitutionVariables(irc, msg, env=None):
|
||||
"""Returns the dict-like object used to make standard substitutions
|
||||
on text sent to IRC. Usually you'll want to use
|
||||
:py:func:`standardSubstitute` instead, which runs the actual substitution
|
||||
itself."""
|
||||
def randInt():
|
||||
return str(random.randint(-1000, 1000))
|
||||
def randDate():
|
||||
@ -1012,12 +1016,18 @@ def standardSubstitute(irc, msg, text, env=None):
|
||||
|
||||
if env is not None:
|
||||
vars.update(env)
|
||||
|
||||
return vars
|
||||
|
||||
|
||||
def standardSubstitute(irc, msg, text, env=None):
|
||||
"""Do the standard set of substitutions on text, and return it"""
|
||||
vars = standardSubstitutionVariables(irc, msg, env)
|
||||
t = string.Template(text)
|
||||
t.idpattern = '[a-zA-Z][a-zA-Z0-9]*'
|
||||
return t.safe_substitute(vars)
|
||||
|
||||
|
||||
|
||||
AUTHENTICATE_CHUNK_SIZE = 400
|
||||
def authenticate_generator(authstring, base64ify=True):
|
||||
if base64ify:
|
||||
|
Loading…
Reference in New Issue
Block a user