[formatter] implement 'C' format specifier (#5647)

to apply a conversion after ':' or
to apply multiple conversions

for example {tags:CSl} or {tags:J - /Cl}
to convert list to string and lowercase it
This commit is contained in:
Mike Fährmann
2024-06-05 15:25:01 +02:00
parent 9b99d2c886
commit 1ce5de0290
3 changed files with 32 additions and 0 deletions

View File

@@ -267,6 +267,11 @@ class TestFormatter(unittest.TestCase):
"{a:Sort-reverse}", # starts with 'S', contains 'r'
"['w', 'r', 'o', 'l', 'h', 'd', 'O', 'L', 'L', 'E', ' ']")
def test_specifier_conversions(self):
self._run_test("{a:Cl}" , "hello world")
self._run_test("{h:CHC}" , "Foo & Bar")
self._run_test("{l:CSulc}", "A, b, c")
def test_chain_special(self):
# multiple replacements
self._run_test("{a:Rh/C/RE/e/RL/l/}", "Cello wOrld")