Official filter and tag addons for pongo2
Go to file
2022-11-21 14:30:57 +01:00
v4 replace 2022-05-06 14:52:58 +02:00
v5 replace 2022-05-06 14:52:58 +02:00
v6 added v6 2022-11-21 14:22:40 +01:00
.gitignore slugify-filter and tests added. 2014-07-26 17:28:14 +02:00
.travis.yml Update .travis.yml 2020-08-05 10:43:49 +02:00
filters_test.go make master,v4,v5 compatible 2022-05-06 14:34:48 +02:00
filters.go replace 2022-05-06 14:52:58 +02:00
go.mod added v6 2022-11-21 14:22:40 +01:00
go.sum added v6 2022-11-21 14:22:40 +01:00
helpers.go truncatesentences-filter added. 2014-07-30 22:58:02 +02:00
LICENSE Initial commit 2014-07-20 00:24:32 +02:00
README.md update README 2022-11-21 14:30:57 +01:00

pongo2-addons

Fork of the official filter and tag add-ons for pongo2. Since this package uses 3rd-party-libraries, it's in its own package.

How to install and use

Install via go get -u code.icod.de/dalu/pongo2-addons. All dependencies will be automatically fetched and installed.

Simply add the following import line after importing pongo2:

master : _ "code.icod.de/dalu/pongo2-addons"

v4: _ "code.icod.de/dalu/pongo2-addons/v4"

v5: _ "code.icod.de/dalu/pongo2-addons/v5"

v6: _ "code.icod.de/dalu/pongo2-addons/v6"

All additional filters/tags will be registered automatically.

Addons

Filters

  • 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 use naturaltime)
    • timesince/timeuntil/naturaltime (human-readable time [duration] indicator)

Tags

(nothing yet)

TODO

  • Support i18n/i10n

Used libraries

I want to thank the authors of these libraries (which are being used in pongo2-addons):