{% macro options(current, values, default) -%} {% for value in values %} {% endfor %} {%- endmacro %} {% macro sort(root, methods, selected) -%} {% for method in methods %} {{ format!("{}{}", method.get(0..1).unwrap_or_default().to_uppercase(), method.get(1..).unwrap_or_default()) }} {% endfor %} {%- endmacro %} {% macro search(root, search) -%} {%- endmacro %} {% macro render_flair(flair_parts) -%} {% for flair_part in flair_parts.clone() %}{% if flair_part.flair_part_type == "emoji" %}{% else if flair_part.flair_part_type == "text" && !flair_part.value.is_empty() %}{{ flair_part.value }}{% endif %}{% endfor %} {%- endmacro %} {% macro sub_list(current) -%}
Feeds

MAIN FEEDS

Home Popular All {% if prefs.subscriptions.len() > 0 %}

REDDIT FEEDS

{% for sub in prefs.subscriptions %} {{ sub }} {% endfor %} {% endif %}
{%- endmacro %} {% macro render_hls_notification(redirect_url) -%} {% if post.post_type == "video" && !post.media.alt_url.is_empty() && prefs.hide_hls_notification != "on" %}

Enable HLS to view with audio, or disable this notification

{% endif %} {%- endmacro %} {% macro post(post) -%}

r/{{ post.community }} {% if post.author.flair.flair_parts.len() > 0 %} {% call render_flair(post.author.flair.flair_parts) %} {% endif %} {{ post.rel_time }} {% if !post.awards.is_empty() && prefs.hide_awards != "on" %} {% for award in post.awards.clone() %} {{ award.name }} {{ award.count }} {% endfor %} {% endif %}

{{ post.title }} {% if post.flair.flair_parts.len() > 0 %} {% call render_flair(post.flair.flair_parts) %} {% endif %} {% if post.flags.nsfw %} NSFW{% endif %}

{% if post.post_type == "image" %}
{% if post.media.height == 0 || post.media.width == 0 %} Post image {% else %} Post image {% endif %}
{% else if post.post_type == "video" || post.post_type == "gif" %} {% if prefs.use_hls == "on" && !post.media.alt_url.is_empty() %}
{% else %}
{% call render_hls_notification(post.permalink[1..]) %} {% endif %} {% else if post.post_type == "gallery" %} {% else if post.post_type == "link" %} {{ post.media.url }} {% endif %}
{{ post.body|safe }}
{% if prefs.hide_score != "on" %} {{ post.score.0 }} {% else %} • {% endif %} Upvotes

{{ post.upvote_ratio }}% Upvoted

{%- endmacro %} {% macro external_reddit_link(permalink) %} {% for dev_type in ["desktop", "mobile"] %}
  • reddit {% if prefs.disable_visit_reddit_confirmation != "on" %} {% call visit_reddit_confirmation(permalink) %} {% endif %}
  • {% endfor %} {% endmacro %} {% macro post_in_list(post) -%}

    {% let community -%} {% if post.community.starts_with("u_") -%} {% let community = format!("u/{}", &post.community[2..]) -%} {% else -%} {% let community = format!("r/{}", post.community) -%} {% endif -%} {{ community }} {{ post.rel_time }} {% if !post.awards.is_empty() && prefs.hide_awards != "on" %} {% for award in post.awards.clone() %} {{ award.name }} {% endfor %} {% endif %}

    {% if post.flair.flair_parts.len() > 0 %} {% call render_flair(post.flair.flair_parts) %} {% endif %} {{ post.title }}{% if post.flags.nsfw %} NSFW{% endif %}

    {% if (prefs.layout.is_empty() || prefs.layout == "card" || prefs.layout == "mosaic") && post.post_type == "image" %}
    {% if post.media.height == 0 || post.media.width == 0 %} Post image {% else %} Post image {% endif %}
    {% else if (prefs.layout.is_empty() || prefs.layout == "card" || prefs.layout == "mosaic") && post.post_type == "gif" %}
    {% else if (prefs.layout.is_empty() || prefs.layout == "card" || prefs.layout == "mosaic") && post.post_type == "video" %} {% if prefs.use_hls == "on" && !post.media.alt_url.is_empty() %}
    {% else %}
    {% call render_hls_notification(format!("{}%23{}", &self.url[1..].replace("&", "%26").replace("+", "%2B"), post.id)) %} {% endif %} {% else if post.post_type != "self" %} {% if post.thumbnail.url.is_empty() %} Thumbnail {% else %}
    Thumbnail
    {% endif %} {% if post.post_type == "link" %}{{ post.domain }}{% else %}{{ post.post_type }}{% endif %}
    {% endif %}
    {% if prefs.hide_score != "on" %} {{ post.score.0 }} {% else %} • {% endif %} Upvotes
    {{ post.body|safe }}
    {% call poll(post) %}
    {{ post.comments.0 }} {% if post.comments.1 == "1" %}comment{% else %}comments{% endif %}
    {%- endmacro %} {% macro visit_reddit_confirmation(url) -%} {%- endmacro %} {% macro poll(post) -%} {% match post.poll %} {% when Some with (poll) %} {% let widest = poll.most_votes() %}
    {{ poll.total_vote_count }} votes, {{ poll.voting_end_timestamp.0 }} {% for option in poll.poll_options %}
    {# Posts without vote_count (all open polls) will show up without votes. This is an issue with Reddit API, it doesn't work on Old Reddit either. #} {% match option.vote_count %} {% when Some with (vote_count) %} {% if vote_count.eq(widest) || widest == 0 %}
    {% else %}
    {% endif %} {{ vote_count }} {% when None %}
    {% endmatch %} {{ option.text }}
    {% endfor %}
    {% when None %} {% endmatch %} {%- endmacro %}