{% macro flashed_messages() %} {%- if get_flashed_messages() %} {%- endif %} {% endmacro %} {% macro csrf_token_field() -%} {%- endmacro %} {% macro filter_form(form) %}
{{ caller() }}
{% endmacro %} {%- macro filter_radio(field) %}
{{ field.label.text }}
{%- for option in field %}
{{ option(class="form-check-input") }} {{ option.label(class="form-check-label") }}
{%- endfor %}
{%- endmacro %} {% macro toggle_button(state, post_url, name, states, disabled_element='this') -%} {%- set value = states[not state][0] -%} {%- set label = states[not state][1] -%} {%- set icon = states[not state][2] -%} {% endmacro %} {% macro feed_enabled_button(feed) %} {%- if not feed.url.startswith('reader:') %} {{ toggle_button( feed.updates_enabled, url_for('.feed_actions'), 'enabled', (['disable', 'disable'], ['enable', 'enable']), style="width: 5rem", ) }} {%- endif %} {% endmacro %} {% macro entry_read_button(entry) -%} {{ toggle_button( entry.read, url_for('.entry_actions'), 'read', (['unread', 'mark as unread', 'check-circle-fill'], ['read', 'mark as read', 'check-lg']), style="width: 4rem", ) }} {%- endmacro %} {% macro entry_important_button(entry) -%}
{{ toggle_button( entry.important is true, url_for('.entry_actions'), 'important', (['clear', 'clear important', 'star-fill'], ['important', 'mark as important', 'star']), disabled_element="this, next button", style="width: 2rem", ) }} {{ toggle_button( entry.important is false, url_for('.entry_actions'), 'important', (['clear', "clear don't care", 'x-circle-fill'], ['unimportant', "don't care", 'x-lg']), disabled_element="this, previous button", style="width: 2rem", ) }}
{%- endmacro %} {% macro change_feed_title_button(feed) -%} change title {%- endmacro %} {% macro delete_feed_button(feed) -%} delete {%- endmacro %} {% macro feed_url_button(feed) -%} {%- if not feed.url.startswith('reader:') %} {% endif -%} {%- endmacro %} {% macro feed_error_button(feed) -%} {%- if feed.last_exception and feed.updates_enabled %} {% endif -%} {%- endmacro %} {%- macro feed_updated(feed) %} {%- set updated = feed.updated or feed.last_updated -%} {#- TODO: updated should be a tooltip #} {#- TODO: babel.format_timedelta(..., format='narrow') -> 3h #}
  • {{ updated | humanize_naturaltime if updated else 'not updated' }}
  • {%- endmacro %} {% macro feed_author(feed) %} {%- set author = feed.author if feed.author != feed.resolved_title else none -%} {%- if author %}
  • by {{ author }}
  • {%- endif %} {% endmacro %} {% macro entry_feed(entry) %}
  • {{ entry.feed_resolved_title or entry.feed.url }}
  • {% endmacro %} {% macro entry_published(entry) %} {%- set published = entry.published or entry.updated_not_none -%} {#- otherwise we get ValueError for datetime(1, 1, 1) -#} {%- set published = published if published.year >= 1900 else none -%} {#- TODO: published should be a tooltip #} {#- TODO: babel.format_timedelta(..., format='narrow') -> 3h #} {%- if published %}
  • {{ published | humanize_naturaltime }}
  • {%- endif %} {% endmacro %} {% macro entry_author(entry) %} {%- set author = entry.author or entry.feed.author -%} {%- set author = author if author != entry.feed_resolved_title else none -%} {%- if author %}
  • by {{ author }}
  • {%- endif %} {% endmacro %} {% macro title_href(text, href=none, external=none, feed_url=none) %} {%- set text = text | truncate(95) -%} {%- macro maybe_href(text, href) %} {%- if href %}{% endif -%} {{ text }} {%- if href %}{% endif -%} {%- endmacro %} {%- if not (external or feed_url) %} {{ maybe_href(text, href) }} {%- else %} {%- set first, _, last = text.strip().rpartition(' ') -%} {{ maybe_href(first, href) }} {{ maybe_href(last, href) }} {% if external %} {% endif %} {% if feed_url %} {% endif %} {%- endif %} {%- endmacro %} {% macro subtitle(text, class=none) %} {%- set text = (text or '') | striptags | trim -%} {%- if text %}

    {{ text | truncate(223) }}

    {%- endif %} {% endmacro %} {%- macro bs_file_icon(mimetype) -%} {%- set type = (mimetype or '').partition('/')[0] -%} {%- if type == 'audio' -%} file-earmark-music {%- elif type == 'image' -%} file-earmark-image {%- elif type == 'video' -%} file-earmark-play {%- elif type == 'text' -%} file-earmark-text {%- else -%} file-earmark {%- endif -%} {%- endmacro -%} {% macro pagination_top() %} {%- endmacro %}