-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
#
from random import randint, random
from urllib.parse import urlparse
return title_from_tags(tags)
template = Template("{{ category }}: <a href='{{ tag.get_absolute_url }}'>{{ tag.name }}</a>")
return mark_safe(capfirst(",<br/>".join(
- template.render(Context({'tag': tag, 'category': _(tag.category)})) for tag in tags)))
+ template.render(Context({'tag': tag, 'category': tag.get_category_display()})) for tag in tags)))
def simple_title(tags):
title = []
for tag in tags:
- title.append("%s: %s" % (_(tag.category), tag.name))
+ title.append("%s: %s" % (tag.get_category_display(), tag.name))
return capfirst(', '.join(title))
return ''
-@register.simple_tag
-def audiobook_tree(book_list, books_by_parent):
- text = "".join("<li><a class='open-player' href='%s'>%s</a>%s</li>" % (
- reverse("book_player", args=[book.slug]), book.title,
- audiobook_tree(books_by_parent.get(book, ()), books_by_parent)
- ) for book in book_list)
-
- if text:
- return mark_safe("<ol>%s</ol>" % text)
- else:
- return ''
-
-
@register.simple_tag
def book_tree_texml(book_list, books_by_parent, depth=1):
return mark_safe("".join("""
}
-@register.inclusion_tag('catalogue/inline_tag_list.html')
-def inline_tag_list(tags, choices=None, category=None, list_type='books'):
- return tag_list(tags, choices, category, list_type)
-
-
-@register.inclusion_tag('catalogue/collection_list.html')
-def collection_list(collections):
- return {'collections': collections}
-
-
@register.inclusion_tag('catalogue/book_info.html')
def book_info(book):
return {
@register.inclusion_tag('catalogue/snippets/content_warning.html')
def content_warning(book):
warnings_def = {
- 'wulgaryzmy': _('vulgar language'),
+ 'wulgaryzmy': _('wulgaryzmy'),
}
warnings = book.get_extra_info_json().get('content_warnings', [])
warnings = sorted(