Skip to content

Commit

Permalink
feat: add sample jinja filter
Browse files Browse the repository at this point in the history
  • Loading branch information
fyhertz committed Feb 20, 2022
1 parent 35796ff commit c1770c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wakemebot/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path
from random import sample
from typing import Any, Dict, List, Optional

from jinja2 import Environment
Expand All @@ -13,7 +14,10 @@
from .apt import parse_repository
from .badges import Badge

filters = {"sample": sample}

environment = Environment()
environment.filters.update(filters)


class WakeMeDocPlugin(BasePlugin):
Expand Down Expand Up @@ -101,6 +105,7 @@ def on_files(self, files: Files, config: Config) -> Files:

def on_env(self, env: Environment, config: Config, files: Files) -> Environment:
env.globals.update({"repository": self.repository, "packages": self.packages})
env.filters.update(filters)
return env

def on_page_context(
Expand Down

0 comments on commit c1770c2

Please sign in to comment.