Add cat macro
This concatenates all the arguments without spaces. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -246,6 +246,11 @@ def macro_round(ctx: MarkupContext, n: str, digits: Optional[str] = None) -> str
|
||||
return str(res)
|
||||
|
||||
|
||||
def macro_cat(ctx: MarkupContext, *text: str) -> str:
|
||||
"Concatenates all arguments."
|
||||
return ''.join(text)
|
||||
|
||||
|
||||
@functools.cache
|
||||
def default_context():
|
||||
c = MarkupContext()
|
||||
@@ -253,6 +258,8 @@ def default_context():
|
||||
c.register_macro("choose", macro_choose)
|
||||
c.register_macro("round", macro_round)
|
||||
|
||||
c.register_macro("cat", macro_cat)
|
||||
|
||||
return c
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user