dropin

alternative frontend for dropout.tv
git clone https://git.ce9e.org/dropin.git

commit
b29c5873e02982cc643c8e20128d765b6d2f7155
parent
91295cfd6db8e7604ccbdfb058a0a95689721a47
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-02-07 11:16
render linebreaks for descriptions

Diffstat

M dropin.py 11 +++++++++++
M requirements.txt 1 +
M templates/collection.html 2 +-
M templates/series.html 4 ++--
M templates/video.html 2 +-

5 files changed, 16 insertions, 4 deletions


diff --git a/dropin.py b/dropin.py

@@ -12,6 +12,7 @@ from pathlib import Path
   12    12 import aiohttp
   13    13 import jinja2
   14    14 from aiohttp import web
   -1    15 from markupsafe import Markup
   15    16 
   16    17 BASE_DIR = Path(__file__).parent
   17    18 SITE_ID = 36348
@@ -61,6 +62,16 @@ def duration(value):
   61    62 env.filters['duration'] = duration
   62    63 
   63    64 
   -1    65 def linebreaks(text):
   -1    66     return Markup('').join(
   -1    67         Markup('<p>{}</p>').format(
   -1    68             Markup('<br>').join(p.split('\n'))
   -1    69         )
   -1    70         for p in re.split(r'\n\n+', text)
   -1    71     )
   -1    72 env.filters['linebreaks'] = linebreaks
   -1    73 
   -1    74 
   64    75 class Auth:
   65    76     def __init__(self, email=None, password=None):
   66    77         self.email = email

diff --git a/requirements.txt b/requirements.txt

@@ -1,2 +1,3 @@
    1     1 aiohttp
    2     2 Jinja2
   -1     3 MarkupSafe

diff --git a/templates/collection.html b/templates/collection.html

@@ -5,7 +5,7 @@
    5     5 {% block content %}
    6     6     <div class="wrapper-wide">
    7     7         <h1>{{ title }}</h1>
    8    -1         {% if description %}<p class="description">{{ description }}</p>{% endif %}
   -1     8         {% if description %}<div class="description">{{ description|linebreaks }}</div>{% endif %}
    9     9         {% include '_list.html' %}
   10    10     </div>
   11    11 {% endblock %}

diff --git a/templates/series.html b/templates/series.html

@@ -9,12 +9,12 @@
    9     9 {% block content %}
   10    10     <div class="wrapper-wide">
   11    11         <h1>{{ title }}</h1>
   12    -1         {% if description %}<p class="description">{{ description }}</p>{% endif %}
   -1    12         {% if description %}<div class="description">{{ description|linebreaks }}</div>{% endif %}
   13    13 
   14    14         {% for season in seasons|reverse %}
   15    15             <h2 id="season-{{ season.season_number }}">{{ season.title }}</h2>
   16    16             <time title="{{ season.created_at }}">{{ season.created_at|dt }}</time>
   17    -1             {% if season.description %}<p class="description">{{ season.description }}</p>{% endif %}
   -1    17             {% if season.description %}<div class="description">{{ season.description|linebreaks }}</div>{% endif %}
   18    18             {% with items = season.episodes %}
   19    19                 {% include '_list.html' %}
   20    20             {% endwith %}

diff --git a/templates/video.html b/templates/video.html

@@ -28,7 +28,7 @@
   28    28             {{ duration|duration }} &middot;
   29    29             <time title="{{ created_at }}">{{ created_at|dt }}</time>
   30    30         </div>
   31    -1         {% if description %}<p class="description">{{ description }}</p>{% endif %}
   -1    31         {% if description %}<div class="description">{{ description|linebreaks }}</div>{% endif %}
   32    32         {% if tags %}
   33    33             <ul class="tags">
   34    34                 {% for tag in tags %}