Skip to content

Commit

Permalink
Make slugify available to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
yaph committed Dec 23, 2023
1 parent 1f5385b commit b430180
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion logya/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from jinja2 import Environment, FileSystemLoader
from markupsafe import escape

from logya.util import cache
from logya.util import cache, slugify


env = Environment(
Expand Down Expand Up @@ -96,6 +96,9 @@ def init_env(L):
# Filter docs list where the given attribute contains the given value.
env.filters['attr_contains'] = lambda docs, attr, val: [doc for doc in docs if val in doc.get(attr, '')]

# Make slugify available
env.filters['slugify'] = slugify

# Include the source of a file.
env.globals['filesource'] = lambda name, **kwargs: _filesource(L.paths.root, name, **kwargs)

Expand Down

0 comments on commit b430180

Please sign in to comment.