1
Fork 0

Add filter for getting category from all

This commit is contained in:
Jake Howard 2016-05-28 21:21:17 +01:00
parent 8ad6364690
commit eda46a3bad
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 9 additions and 1 deletions

View file

@ -82,6 +82,7 @@ SITEMAP = {
import filters
JINJA_FILTERS = {
"datetime": filters.format_datetime,
"raw": filters.html_to_raw
"raw": filters.html_to_raw,
"category_find": filters.category_find
}
# Extra context

View file

@ -11,3 +11,10 @@ def html_to_raw(html):
for script in soup(["script", "style"]): # Remove script / style tags
script.extract()
return soup.get_text()
def category_find(categories, name):
for category_name, articles in categories:
if category_name == name:
return articles
return []