mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Added a %u specifier to format, for URLs.
This commit is contained in:
parent
3d57c404ba
commit
4ac7bb4717
@ -351,6 +351,7 @@ def format(s, *args, **kwargs):
|
|||||||
q: quoted (takes a string)
|
q: quoted (takes a string)
|
||||||
n: nItems (takes a 2-tuple of (n, item) or a 3-tuple of (n, between, item))
|
n: nItems (takes a 2-tuple of (n, item) or a 3-tuple of (n, between, item))
|
||||||
t: time, formatted (takes an int)
|
t: time, formatted (takes an int)
|
||||||
|
u: url, wrapped in braces (this should be configurable at some point)
|
||||||
"""
|
"""
|
||||||
args = list(args)
|
args = list(args)
|
||||||
args.reverse() # For more efficient popping.
|
args.reverse() # For more efficient popping.
|
||||||
@ -396,6 +397,8 @@ def format(s, *args, **kwargs):
|
|||||||
raise ValueError, 'Invalid value for %%n in format: %s' % t
|
raise ValueError, 'Invalid value for %%n in format: %s' % t
|
||||||
elif char == 't':
|
elif char == 't':
|
||||||
return timestamp(args.pop())
|
return timestamp(args.pop())
|
||||||
|
elif char == 'u':
|
||||||
|
return '<%s>' % args.pop()
|
||||||
elif char == '%':
|
elif char == '%':
|
||||||
return '%'
|
return '%'
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user