diff --git a/docs/formatting.md b/docs/formatting.md
index 1e695bf2..97801653 100644
--- a/docs/formatting.md
+++ b/docs/formatting.md
@@ -76,6 +76,12 @@ Conversion specifiers allow to *convert* the value to a different form or type.
{tags!j} |
["sun", "tree", "water"] |
+
+ L |
+ Return the length of a value |
+ {foo!L} |
+ 7 |
+
t |
Trim a string, i.e. remove leading and trailing whitespace characters |
@@ -84,13 +90,13 @@ Conversion specifiers allow to *convert* the value to a different form or type.
T |
- Convert a datetime object to a unix timestamp |
+ Convert a datetime object to a Unix timestamp |
{date!T} |
1262304000 |
d |
- Convert a unix timestamp to a datetime object |
+ Convert a Unix timestamp to a datetime object |
{created!d} |
2010-01-01 00:00:00 |
diff --git a/gallery_dl/formatter.py b/gallery_dl/formatter.py
index b50bd643..e662c34e 100644
--- a/gallery_dl/formatter.py
+++ b/gallery_dl/formatter.py
@@ -485,6 +485,7 @@ _CONVERSIONS = {
"C": string.capwords,
"j": util.json_dumps,
"t": str.strip,
+ "L": len,
"T": util.datetime_to_timestamp_string,
"d": text.parse_timestamp,
"U": text.unescape,
diff --git a/test/test_formatter.py b/test/test_formatter.py
index 38c22ab9..f1d752da 100644
--- a/test/test_formatter.py
+++ b/test/test_formatter.py
@@ -67,6 +67,9 @@ class TestFormatter(unittest.TestCase):
self._run_test("{l!j}", '["a", "b", "c"]')
self._run_test("{dt!j}", '"2010-01-01 00:00:00"')
self._run_test("{a!g}", "hello-world")
+ self._run_test("{a!L}", 11)
+ self._run_test("{l!L}", 3)
+ self._run_test("{d!L}", 3)
with self.assertRaises(KeyError):
self._run_test("{a!q}", "hello world")