From 2e19d06f939629623ce1878a8f00c67ab57ac060 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Tue, 26 Oct 2021 00:22:28 +0200 Subject: [PATCH] macros.htm: Extract link_position_marker() macro --- server/templates/macros.htm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/server/templates/macros.htm b/server/templates/macros.htm index 2e1c546..2c69558 100644 --- a/server/templates/macros.htm +++ b/server/templates/macros.htm @@ -68,6 +68,17 @@ {% endif %} {% endmacro %} +{% macro link_position_marker(link, prefix=false) -%} + {{- prefix and (link.season != 0 or link.episode != 0) | tenary(", ", "") -}} + {%- if link.season != 0 -%} + Season {{ link.season }} + {{- link.episode != 0 | tenary(", ", "") -}} + {%- endif -%} + {%- if link.episode != 0 -%} + Episode {{ link.episode }} + {%- endif -%} +{%- endmacro %} + {% macro media_entry_content(element) %} {{ media_element_buttons(element) }} {{ element.release_date.strftime("%d.%m.%Y") }} @@ -77,12 +88,7 @@ {% macro link_entry_content(link) %} {{ media_entry_content(link.element) -}} - {%- if link.season != 0 -%} - , Season {{ link.season }} - {%- endif -%} - {%- if link.episode != 0 -%} - , Episode {{ link.episode }} - {%- endif -%} + {{- link_position_marker(link, prefix=true) -}} {%- endmacro %} {% macro media_entry(element) %}