From d3db16c63db3df4a0a6c2298d8111f62a2c088d1 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 29 Jul 2018 20:24:46 +0200 Subject: [PATCH] Add support for Article --- app.py | 8 ++++++++ templates/lookup.html | 2 +- templates/utils.html | 11 +++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index ff9c410..ba23e16 100644 --- a/app.py +++ b/app.py @@ -336,6 +336,14 @@ def has_type(doc, _type): return False +@app.template_filter() +def has_actor_type(doc): + for t in ap.ACTOR_TYPES: + if has_type(doc, t.value): + return True + return False + + def _is_img(filename): filename = filename.lower() if ( diff --git a/templates/lookup.html b/templates/lookup.html index a8fb5f7..31932c1 100644 --- a/templates/lookup.html +++ b/templates/lookup.html @@ -15,7 +15,7 @@ {% if data %} {% set data = data.to_dict() %}
- {% if data | has_type('Person') or data | has_type('Service') %} + {% if data | has_actor_type %}
diff --git a/templates/utils.html b/templates/utils.html index 5cc6941..78cd27d 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -23,6 +23,7 @@ {% else %} {% set actor = obj.attributedTo | get_actor %} {% endif %} +
@@ -33,6 +34,7 @@
+ {% if obj.summary %}

{{ obj.summary | clean }}

{% endif %}
+ {% if obj | has_type('Article') %} + {{ obj.name }} {{ obj | url_or_id | get_url }} + {% else %} {{ obj.content | clean | safe }} + {% endif %}
- {% if obj.attachment %} + {% if obj.attachment and obj | has_type('Note') %}
{% if obj.attachment | not_only_imgs %}

Attachment

@@ -68,7 +75,7 @@ -{% if meta and meta.og_metadata %} +{% if meta and meta.og_metadata and obj | has_type('Note') %} {% for og in meta.og_metadata %}