summaryrefslogtreecommitdiff
path: root/htmtl/expression_modifiers/truncate.py
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2025-01-02 01:30:23 +0200
committerAsko Nõmm <asko@nmm.ee>2025-01-02 01:30:23 +0200
commit689fe2613765de71101214a482c928cfdb1b2be6 (patch)
tree53ff6f9a092caee32e5c600bccf5ee546bd8bc20 /htmtl/expression_modifiers/truncate.py
parent5e08a8b2f9258ae1f0aca7e3ad044b6360e07458 (diff)
Clean up some naming usages and things
Diffstat (limited to 'htmtl/expression_modifiers/truncate.py')
-rw-r--r--htmtl/expression_modifiers/truncate.py16
1 files changed, 0 insertions, 16 deletions
diff --git a/htmtl/expression_modifiers/truncate.py b/htmtl/expression_modifiers/truncate.py
deleted file mode 100644
index 41a1bdb..0000000
--- a/htmtl/expression_modifiers/truncate.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from typing import Any
-
-from ..expression_modifier import ExpressionModifier, modifier
-
-
-@modifier("truncate")
-class Truncate(ExpressionModifier):
- def modify(self, value: Any, opts: list[Any]) -> Any:
- if isinstance(value, str) and len(opts) > 0:
- if all([x in "1234567890" for x in opts[0]]):
- char_limit = int(opts[0])
-
- if len(value) > char_limit:
- return f"{value[:char_limit - 3]}..."
-
- return value