aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-01-17 23:37:45 -0500
committerJesús <heckyel@hyperbola.info>2022-01-17 23:37:45 -0500
commit3b57335e4cb7d491f623da3d13c8f1d947ce2af2 (patch)
tree6d601dc2f5c254c2cf424fa62e995af465d822dc /youtube
parenta5ef801c073e2be932430b13ab7c0524e1c1e1b6 (diff)
downloadyt-local-3b57335e4cb7d491f623da3d13c8f1d947ce2af2.tar.lz
yt-local-3b57335e4cb7d491f623da3d13c8f1d947ce2af2.tar.xz
yt-local-3b57335e4cb7d491f623da3d13c8f1d947ce2af2.zip
[Design]: fix author_description
Diffstat (limited to 'youtube')
-rw-r--r--youtube/templates/common_elements.html14
1 files 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 @@
</a>
<h4 class="title"><a href="{{ info['url'] }}" title="{{ info['title'] }}">{{ info['title'] }}</a></h4>
+ {% 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') %}
- <address title="{{ info['author'] }}"><b><a href="{{ info['author_url'] }}">{{ info['author'] }}</a></b></address>
+ <address title="{{ info['author'] }}"><b><a href="{{ info['author_url'] }}">{{ author_description }}</a></b></address>
{% else %}
- <address title="{{ info['author'] }}"><b>{{ info['author'] }}</b></address>
+ <address title="{{ info['author'] }}"><b>{{ author_description }}</b></address>
{% endif %}
{% endif %}