When no context_line is available, don't display code sample

This commit is contained in:
Klaas van Schelven
2024-04-03 10:31:11 +02:00
parent eba7f1c628
commit 90197fccc1

View File

@@ -52,6 +52,7 @@
{% if not forloop.parentloop.last or not forloop.last %}data-collapsed="true" style="height: 0px"{% endif %}> {# collapsable part #}
<div class="pl-6 pr-6 pt-8 {% if not forloop.last %}border-b-2 border-slate-400{% endif %}">{# convience div for padding & border; the border is basically the top-border of the next header #}
{% if context_line in frame %}
<div class="bg-slate-50 syntax-coloring">{# code listing #}
{# the spread-out pX-6 in this code is intentional to ensure the padding is visible when scrolling to the right, and not visible when scrolling is possible (i.e. the text is cut-off awkwardly to hint at scrolling #}
<ol class="list-decimal overflow-x-auto list-inside pt-6 pb-6 {% if frame|firstlineno is None %}list-none{% endif %}" start="{{ frame|firstlineno }}">
@@ -62,6 +63,7 @@
{% for line in frame.post_context %}<li class="pl-6"><div class="whitespace-pre w-full inline pr-6">{{ line }} {# leave space to avoid collapse #}</div></li>{% endfor %}
</ol>
</div>
{% endif %}
{% if frame.vars %}
<div class="pt-4 pb-6">{# variables #}