From 3b57335e4cb7d491f623da3d13c8f1d947ce2af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Mon, 17 Jan 2022 23:37:45 -0500 Subject: [Design]: fix author_description --- youtube/templates/common_elements.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/youtube/templates/common_elements.html b/youtube/templates/common_elements.html index 808a835..f019edf 100644 --- a/youtube/templates/common_elements.html +++ b/youtube/templates/common_elements.html @@ -37,11 +37,21 @@

{{ info['title'] }}

+ {% set author_description = info['author'] %} + {% set AUTHOR_DESC_LENGTH = 35 %} + {% if author_description|length >= AUTHOR_DESC_LENGTH %} + {% set author_description = author_description[:AUTHOR_DESC_LENGTH].split(' ')[:-1]|join(' ') %} + {% if not author_description[-1] in ['.', '?', ':', '!'] %} + {% set author_more = author_description + '…' %} + {% set author_description = author_more|replace('"','') %} + {% endif %} + {% endif %} + {% if include_author %} {% if info.get('author_url') %} -
{{ info['author'] }}
+
{{ author_description }}
{% else %} -
{{ info['author'] }}
+
{{ author_description }}
{% endif %} {% endif %} -- cgit v1.2.3