From 89848de97da23a8c732f54bde15080b09e2bb9d9 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Thu, 2 Jan 2025 21:36:00 +0200 Subject: bump --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 216758e..a980e2e 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ you to use any editor without needing any additional editor extensions.

- +

-
+
@@ -269,14 +269,14 @@ If the `slug` key is `hello-world`. All interpolated values in expressions can be modified using modifiers. Modifiers are applied to the value of the attribute, and they can be chained, like so: ```html -

+

``` Note that if you have nothing other than the interpolated variable in the attribute, then you can omit the curly brackets, and so this would also work: ```html -

+

``` ### `date` @@ -284,7 +284,7 @@ this would also work: Parses the value into a formatted date string. ```html -

+

``` ### `truncate` @@ -292,7 +292,7 @@ Parses the value into a formatted date string. Truncates the value to the specified length. ```html -

+

``` This also works on collections, so you can use `truncate` to limit items in an array as well. @@ -370,10 +370,9 @@ Mdifiers must extend the `Modifier` class, like so: ```python from typing import Any -from htmtl import Modifier, modifier_name +from htmtl import Modifier -@modifier_name("truncate") class Truncate(Modifier): def modify(self, value: Any, opts: list[Any]) -> Any: if isinstance(value, str) and len(opts) > 0: @@ -386,9 +385,6 @@ class Truncate(Modifier): return value ``` -All modifiers need to have a name (that you will use in your templates), and you can name your modifier -with the `modifier_name` decorator. - #### List of built-in modifiers - `htmtl.modifiers.Truncate` - Truncates the value (both strings and collections). -- cgit v1.2.3