https://github.com/flosch/pongo2-addons
Official filter and tag addons for pongo2
https://github.com/flosch/pongo2-addons
Last synced: over 1 year ago
JSON representation
Official filter and tag addons for pongo2
- Host: GitHub
- URL: https://github.com/flosch/pongo2-addons
- Owner: flosch
- License: mit
- Created: 2014-07-19T22:24:32.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2022-11-21T13:34:13.000Z (over 3 years ago)
- Last Synced: 2025-03-18T06:51:29.753Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 39
- Watchers: 3
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pongo2-addons
[](https://travis-ci.org/flosch/pongo2-addons)
[](https://gratipay.com/flosch/)
Official filter and tag add-ons for [pongo2](https://github.com/flosch/pongo2). Since this package uses
3rd-party-libraries, it's in its own package.
## How to install and use
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.
## Addons
### Filters
- Regulars
- **[filesizeformat](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#filesizeformat)** (human-readable filesize; takes bytes as input)
- **[slugify](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#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](https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#intcomma)** (put decimal marks into the number)
- **[ordinal](https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#ordinal)** (convert integer to its ordinal as string)
- **[naturalday](https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#naturalday)** (converts `time.Time`-object into today/yesterday/tomorrow if possible; otherwise it will use `naturaltime`)
- **[timesince](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#timesince)/[timeuntil](https://docs.djangoproject.com/en/1.6/ref/templates/builtins/#timeuntil)/[naturaltime](https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#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`):
* [github.com/extemporalgenome/slug](https://github.com/extemporalgenome/slug)
* [github.com/dustin/go-humanize](https://github.com/dustin/go-humanize)
* [github.com/russross/blackfriday](https://github.com/russross/blackfriday)