~tsileo/microblog.pub

ref: 3048de04e8377d4fdec1e58db3180299950bf9bc microblog.pub/templates/utils.html -rw-r--r-- 20.1 KiB
3048de04Thomas Sileo Fix the display sensitive button 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
{% macro display_actor_inline(follower, size=50) -%}
{% if follower and follower.id %}
<a class="actor-box" href="{{follower | url_or_id | get_url }}" style="clear:both;">
<span style="float:left;padding-right:15px;">
{% if not follower.icon %}
<img class="actor-icon" src="/static/nopic.png" style="width:{{ size }}px">
{% else %}
<img class="actor-icon" src="{{ follower.icon.url | get_actor_icon_url(size) }}" style="width:{{ size }}px;">{% endif %}
</span>
<div class="actor-inline">
<div style="font-weight:bold">{{ (follower.name or follower.preferredUsername) | clean | replace_custom_emojis(follower) | safe }}</div>
<small class="lcolor">@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}</small>
</div>
</a>
{% endif %}
{%- endmacro %}

{% macro display_actor_icon(follower, size=50) -%}
{% if follower and follower.id %}
<a href="{{follower | url_or_id | get_url }}" style="width:65px;padding-left:15px;padding-bottom:15px;text-decoration:none;padding:0;margin:0;height:65px;">
{% if not follower.icon %}
<img class="actor-icon" title="@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}" src="/static/nopic.png" style="width:{{ size }}px;border-radius:2px;margin:0;padding:0">
{% else %}
<img class="actor-icon" title="@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}" src="{{ follower.icon.url | get_actor_icon_url(size) }}" style="width:{{ size }}px;border-radius:2px;">{% endif %}
</a>
{% endif %}
{%- endmacro %}

{% macro display_actor_oneline(follower) -%}
{% if follower and follower.id %}
<span class="actor-inline">
<a href="{{follower | url_or_id | get_url }}" style="clear:both;">
{{ (follower.name or follower.preferredUsername) | clean | replace_custom_emojis(follower) | safe }}
<small class="lcolor">@{{ follower.preferredUsername }}@{{ follower | url_or_id | get_url | domain }}</small>
</a>
</span>
{% endif %}
{%- endmacro %}

{% macro display_actor_box(actor, after=None, before=None, before_url=None) -%}

{% if not actor.icon %}
{% set icon_url = "/static/nopic.png" %}
{% else %}
{% set icon_url = actor.icon.url | get_actor_icon_url(50) %}
{% endif %}

        <span class="bar-item-no-hover" style="padding:0;">
            <span style="display:flex;height:30px;line-height:30px;background: url('{{ icon_url }}') no-repeat;background-size:30px;border-top-left-radius: 2px;border-bottom-left-radius: 2px;">
                {% if before and before_url %}
                <span style="flex-shrink:1; padding:0 10px 0 40px;"><a href="{{before_url}}">{{before}}</a></span>
                <span style="flex-shrink:1;padding-right:10px;">
                <a style="color:#808080;" href="{{ actor.url | get_url }}">{{ ( actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</a>
                </span>
                {% endif %}
                {% if after %}
                <span style="flex-shrink:1;padding-left:40px;">
                <a style="color:#808080;" href="{{ actor.url | get_url }}">{{ ( actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</a>
                </span>
                <span style="flex-shrink:1;padding:0 10px;">{{ after }}</span>
                {% endif %}
            </span>
        </span>


{%- endmacro %}

{% macro display_in_reply_to(meta, obj) -%}

{% if meta.in_reply_to_actor %}
{{ display_actor_box(meta.in_reply_to_actor, before="in reply to", before_url=obj.inReplyTo) }}
{% elif meta.in_reply_to_self %}
<span class="bar-item-no-hover">
<a href="{{ obj.inReplyTo }}">self reply</a>
</span>
{% endif %}

{%- endmacro %}

{% macro display_note(obj, perma=False, likes=[], shares=[], meta={}, no_color=False) -%}

{% if meta.object_actor %}
    {% set actor = meta.object_actor %}
{% elif meta.actor %}
    {% set actor = meta.actor %}
{% else %}
    {% set actor = obj.attributedTo | get_actor  %}
{% endif %}


{% if session.logged_in %}
    {% set perma_id = obj.id | permalink_id %}

    {% if request.args.get('older_than') %}
        {% set redir = request.path + "?older_than=" + request.args.get('older_than') + "#activity-" + perma_id %}
    {% elif request.args.get('newer_than') %}
        {% set redir = request.path + "?newer_than=" + request.args.get('newer_than') + "#activity-" + perma_id %}
    {% else %}
    {% set redir = request.path + "#activity-" + perma_id %}
    {% endif %}

    {% set aid = obj.id | quote_plus %}
{% endif %}

{% set real_end_time = obj.closed or obj.endTime %}

<article class="note-box">
<div class="note h-entry" id="activity-{{ obj.id | permalink_id }}">

<div class="h-card p-author">
<a class="u-url u-uid no-hover" rel="author" href="{{ actor | url_or_id | get_url }}"><img class="u-photo" src="{% if not actor.icon %}/static/nopic.png{% else %}{{ actor.icon.url | get_actor_icon_url(50) }}{% endif %}">
</a>
<data class="p-name" value="{{ actor.name or actor.preferredUsername }}"></data>
</div>

<div class="note-wrapper">
    <aside style="clear:both;height:20px;">
	<a href="{{ actor | url_or_id | get_url }}" style="margin:0;text-decoration:none;margin: 0;text-decoration: none;display: block;width: 75%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;float: left;" class="no-hover">
        <strong>{{ (actor.name or actor.preferredUsername) | clean | replace_custom_emojis(actor) | safe }}</strong>
        <span class="l">@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor.preferredUsername | clean | replace_custom_emojis(actor) | safe }}</span>{% else %}{{ actor.preferredUsername | clean | replace_custom_emojis(actor) | safe }}{% endif %}@{% if not no_color and obj.id | is_from_outbox %}<span class="pcolor">{{ actor | url_or_id | get_url | domain }}</span>{% else %}{{ actor | url_or_id | get_url | domain }}{% endif %}</span></a>

	<span style="float:right;width: 25%;text-align: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;">
		<a rel="noopener" class="u-url u-uid note-permalink l" href="{{ obj | url_or_id | get_url }}">
            <time class="dt-published" title="{{ obj.published }}" datetime="{{ obj.published }}" {% if obj | url_or_id | get_url | is_from_outbox %}{%else%}rel="external noreferrer"{%endif%}>{{ obj.published | format_timeago }}</time></a>
	</span>
    </aside>

	{% if obj.summary %}<p class="p-summary">{{ obj.summary | clean | replace_custom_emojis(obj) | safe }}</p>{% endif %}
    {% if obj | has_type('Video') %}
    <div class="note-video">
    <video controls preload="metadata"  src="{{ obj.url | get_video_url }}" width="480">
    </video>
    </div>
    {% endif %}

    <div class="note-container{% if perma %} perma{%endif%} p-name e-content">
    {% if obj | has_type(['Article', 'Page']) %}
        {{ obj.name }} <a href="{{ obj | url_or_id | get_url }}">{{ obj | url_or_id | get_url }}</a>
    {% elif obj | has_type('Question') %}
        {{ obj.content | update_inline_imgs | clean | replace_custom_emojis(obj) | code_highlight | safe }}

        
        <ul style="list-style:none;padding:0;">
        {% set total_votes = obj | get_total_answers_count(meta) %}
        {% for oneOf in obj.oneOf %}
            {% set pct = 0 %}
            {% if total_votes > 0 %}
                {% set cnt = oneOf.name | get_answer_count(obj, meta) %}
                {% set pct = cnt * 100.0 / total_votes %}
            {% endif %}
            <li class="answer">
                {% if session.logged_in and not meta.poll_answers_sent and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %}
<span><form action="/api/vote" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="choice" value="{{ oneOf.name }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">vote</button>
    </form></span>{% endif %}

                <span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
                <span class="answer-text">
                    <span>{{ '%0.0f'| format(pct) }}%</span>
                    {{ oneOf.name }} {% if oneOf.name | poll_answer_key in meta.poll_answers_sent %}(your vote){% endif %}
                </span>
            </li>
        {% endfor %}
        {% if obj.anyOf %}
        
        {% for anyOf in obj.anyOf %}
            {% set pct = 0 %}
            {% if total_votes > 0 %}
                {% set cnt = anyOf.name | get_answer_count(obj, meta) %}
                {% set pct = cnt * 100.0 / total_votes %}
            {% endif %}
        <li class="answer">
            {% set already_voted = anyOf.name | poll_answer_key in meta.poll_answers_sent %}
         {% if session.logged_in and not already_voted and not (real_end_time | gtnow) and not (obj.id | is_from_outbox) %}
<span><form action="/api/vote" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="choice" value="{{ anyOf.name }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">vote</button>
    </form></span>
    {% elif session.logged_in and already_voted and not (real_end_time | gtnow) %}
    <span style="position:relative;top:5px;height:10px;width:50px;display:inline-block;"></span>
    {% endif %}
        <span class="answer-bar color-menu-background" style="width:{{pct}}%;"></span>
                <span class="answer-text">
                    <span>{{ '%0.0f'| format(pct) }}%</span>
                    {{ anyOf.name }} {% if anyOf.name | poll_answer_key in meta.poll_answers_sent %}(your vote){% endif %}
                </span>
        </li>
        {% endfor %}

        {% endif %}
    </ul>
    <p><small>
    {% if real_end_time | gtnow %}
        Ended {{ real_end_time | format_timeago }} with <strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %}.
    {% else %}
        Ends {{ real_end_time | format_timeago }} (<strong>{{ total_votes }}</strong> vote{% if total_votes | gtone %}s{% endif %} as of now).
    {% endif %}
    </small></p>


    {% else %}
	{{ obj.content | update_inline_imgs | clean | replace_custom_emojis(obj) | code_highlight | safe }}
    {% endif %}

    {% if obj | has_place %}
    <p>Location: {{ obj | get_place | safe }}</p>
    {% endif %}

	</div>

	{% if obj.attachment and obj | has_type('Note') %}
	<div style="padding:20px 0;">

 {% if obj.sensitive and not request.args.get("show_sensitive") == perma_id %}
 <div style="clear:both">
 <form action="{{redir}}" class="action-form"  method="GET" style="display:inline-block">
<input type="hidden" name="show_sensitive" value="{{perma_id}}">
{% for k, v in request.args.items() %}
<input type="hidden" name="{{k}}" value="{{v}}">
{% endfor %}
<button type="submit" class="bar-item-reverse">display sensitive content</button>
</form>
 </div>
 {% else %}

 {% if obj.sensitive %}
 <div style="clear:both;margin-bottom: 20px;">
 <form action="{{redir}}" class="action-form"  method="GET" style="display:inline-block">
{% for k, v in request.args.items() %}
{% if k != "show_sensitive" %}
<input type="hidden" name="{{k}}" value="{{v}}">
{% endif %}
{% endfor %}
<button type="submit" class="bar-item">hide sensitive content</button>
</form>
 </div>
 {% endif %}

	{% if obj.attachment | not_only_imgs %}
	<h3 class="l">Attachments</h3>
	<ul style="padding:0;list-style-type: none;">
	{% endif %}
	{% for a in (obj | iter_note_attachments) %}
    {% if (a.mediaType and a.mediaType.startswith("image/")) or (a.type and a.type == 'Image') %}
    <a href="{{ a.url | get_attachment_url(None) }}">
        <img src="{{a.url | get_attachment_url(720) }}" title="{{ a.name }}" alt="{{ a.name }}" class="img-attachment"></a>
    {% elif (a.mediaType and a.mediaType.startswith("video/")) %}
    <li><video controls preload="metadata"  src="{{ a.url | get_attachment_url(None) }}" title="{{ a.name }}" width="480"></video></li>
    {% elif (a.mediaType and a.mediaType.startswith("audio/")) %}
    <li><audio controls preload="metadata"  src="{{ a.url | get_attachment_url(None) }}" title="{{ a.name }}" style="width:480px;"></audio></li>
	{% else %}
	<li><a href="{{a.url }}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
	{% endif  %}
	{% endfor %}
	{% if obj.attachment | not_only_imgs %}
	</ul>
	{% endif %}

{% endif %}
</div>
	{% endif %}



{% if meta and meta.og_metadata and obj | has_type('Note') %}
{% for og in meta.og_metadata %}
{% if og.url %}
<a href="{{ og.url }}" class="og-link" style="margin:30px 0;clear:both;display: flex;">
{% if og.image | get_og_image_url %}
<div style="padding:0 20px 0 0;">
<img  style="width:100px;border-radius:3px;" src="{{ og.image | get_og_image_url }}">
</div>
{% endif %}
<div>
<strong>{{ og.title }}</strong>
<p>{{ og.description | truncate(80) }}</p>
<small>{{ og.site_name }}</small>
</div>
</a>
{% endif %}
{% endfor %}
{% endif %}




<aside class="bottom-bar">
{% if meta.count_reply and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_reply }}</strong> repl{% if meta.count_reply > 1 %}ies{% else %}y{% endif %}</a>
{% elif meta.count_reply and session.logged_in %}
<a class="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> repl{% if meta.count_reply > 1 %}ies{% else %}y{% endif %}</a>{% endif %}


{% if not perma and meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_boost }}</strong> boost{% if meta.count_boost > 1 %}s{% endif %}</a>{% endif %}
{% if not perma and meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url | get_url }}"><strong>{{ meta.count_like }}</strong> like{% if meta.count_like > 1 %}s{% endif %}</a>{% endif %}

{% if session.logged_in %}
<a class="bar-item" href="/admin/new?reply={{ aid }}">reply</a>

{% if meta | get_visibility | visibility_is_public %}
{% if meta.boosted %}
<form action="/api/undo" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ meta.boosted }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">unboost</button>
</form>
{% else %}
<form action="/api/boost" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">boost</button>
</form>
{% endif %}
{% endif %}

{% if meta.liked %}
<form action="/api/undo" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ meta.liked }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">unlike</button>
</form>
{% else %}
<form action="/api/like" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">like</button>
</form>
{% endif %}

{% if meta.bookmarked or request.path == url_for("admin.admin_bookmarks") %}
<form action="/api/bookmark" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="undo" value="yes">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">unbookmark</button>
</form>
{% else %}
<form action="/api/bookmark" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">bookmark</button>
</form>
{% endif %}



{% if obj.id | is_from_outbox %}
<form action="/api/note/delete" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item" onclick="return confirm('Confirm the delete action?');">delete</button>
</form>
{% if meta.pinned %}
<form action="/api/note/unpin" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">unpin</button>
</form>
{% else %}
<form action="/api/note/pin" class="action-form"  method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ obj.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">pin</button>
</form>
{% endif %}

{% endif %}
{% endif %}

{% if session.logged_in and obj.inReplyTo and not meta.count_reply and not perma %}
<a class="bar-item" href="/admin/thread?oid={{aid}}">thread</a>
{% endif %}

{% if meta | get_visibility | visibility_is_public %}
{% if obj | url_or_id | get_url | is_from_outbox %}
{% if not perma %}
<a class="bar-item" href="{{ obj | url_or_id | get_url }}">permalink</a>
{% endif %}
{% else %}
<a class="bar-item" href="{{ obj | url_or_id | get_url }}" rel="external noreferrer">source</a>
{% if session.logged_in %}
<a class="bar-item" href="/admin/profile?actor_id={{actor.id}}">profile</a>
{% endif %}
{% endif %}
{% endif %}
<a class="bar-item bar-item-no-border">{{ meta | get_visibility | visibility }}</a>

</aside>

{% if likes or shares %}
<aside style="padding-top:20px;">
{% if likes %}
    <h4 style="font-weight:normal"><strong>{{ likes|length }}</strong> like{% if (likes | length) > 1 %}s{% endif %}</h4>
<div style="display:flex;flex-wrap:wrap;">
{% for like in likes %}
{{ display_actor_icon(like) }}
{% endfor %}
</div>
{% endif %}
{% if shares %}
<h4 style="font-weight:normal"><strong>{{ shares|length }}</strong> boost{% if (shares|length) > 1 %}s{% endif %}</h4>
<div style="display:flex;flex-wrap:wrap;">
{% for boost in shares %}
{{ display_actor_icon(boost) }}
{% endfor %}
</div>
{% endif %}
</aside>
{% endif %}


</div>
</div>                       
</article>


{%- endmacro %}

{% macro display_thread(thread, likes=[], shares=[]) -%}
{% for reply in thread %}
{% if reply._requested %}
<div style="margin-left:70px;padding-bottom:5px;margin-bottom:15px;display:inline-block;">
{{ display_in_reply_to(reply.meta, reply.activity.object) }}
</div>
{{ display_note(reply.activity.object, perma=True, likes=likes, shares=shares, meta=reply.meta) }}
{% else %}
<div style="margin-left:70px;padding-bottom:5px;margin-bottom:15px;display:inline-block;">
{{ display_in_reply_to(reply.meta, reply.activity.object) }}
</div>
{{ display_note(reply.activity.object, perma=False, meta=reply.meta) }}
{% endif %}
{% endfor %}
{% endmacro -%}

{% macro display_pagination(older_than, newer_than) -%}
<div class="clear">
    {% if older_than %}
    <a href="{{ config.BASE_URL }}{{ request.path }}?older_than={{older_than}}{% if request.args.get('limit') %}&limit={{request.args.get('limit')}}{% endif %}{% if request.args.get('actor_id') %}&actor_id={{request.args.get('actor_id')}}{% endif %}" rel="next" class="older-link lcolor"><span class="pcolor">🡨</span> Older</a>
    {% endif %}
    {% if newer_than %}
    <a href="{{ config.BASE_URL }}{{ request.path }}?newer_than={{newer_than}}{% if request.args.get('limit') %}&limit={{request.args.get('limit')}}{% endif %}{% if request.args.get('actor_id') %}&actor_id={{request.args.get('actor_id')}}{% endif %}" rel="prev" class="newer-link lcolor">Newer <span class="pcolor">🡪</span></a>
    {% endif %}
</div>
{% endmacro -%}

{% macro display_pagination_links(older_than, newer_than) -%}
{% if older_than %}<link rel="next" href="{{ config.BASE_URL }}{{ request.path }}?older_than={{older_than}}">{% endif %}
{% if newer_than %}<link rel="prev" href="{{ config.BASE_URL }}{{ request.path }}?newer_than={{newer_than}}">{% endif %}
{% endmacro -%}