Official filter and tag add-ons for pongo2. Since this package uses 3rd-party-libraries, it's in its own package.
Install via go get -u github.com/flosch/pongo2-addons
. All dependencies will be automatically fetched and installed.
Simply add the following import line after importing pongo2:
_ "github.com/flosch/pongo2-addons"
All additional filters/tags will be registered automatically.
-
Regulars
- filesizeformat (human-readable filesize; takes bytes as input)
- slugify (creates a slug for a given input)
- truncatesentences / truncatesentences_html (returns the first X sentences [like truncatechars/truncatewords]; please provide X as a parameter)
- random (returns a random element of the input slice)
-
Markup
- markdown
-
Humanize
- intcomma (put decimal marks into the number)
- ordinal (convert integer to its ordinal as string)
- naturalday (converts
time.Time
-object into today/yesterday/tomorrow if possible; otherwise it will usenaturaltime
) - timesince/timeuntil/naturaltime (human-readable time [duration] indicator)
(nothing yet)
- Support i18n/i10n
I want to thank the authors of these libraries (which are being used in pongo2-addons
):