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
|
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight_django.html</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Django HTML Template) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
{# Basic extension of a common file #}
<span style="color:#8e44ad">{% extends</span><span style="color:#8e44ad"> </span><span style="color:#f44f4f">"base_file.html"</span><span style="color:#8e44ad"> </span><span style="color:#8e44ad">%}</span>
<span style="color:#8e44ad">{% block</span><span style="color:#8e44ad"> title </span><span style="color:#8e44ad">%}</span><span style="color:#8e44ad">{{ section.title }}</span><span style="color:#8e44ad">{% endblock %}</span>
<span style="color:#8e44ad">{% block</span><span style="color:#8e44ad"> content </span><span style="color:#8e44ad">%}</span>
<span style="font-weight:bold"><h1></span><span style="color:#8e44ad">{{ section.title }}</span><span style="font-weight:bold"></h1></span>
{# For loop example #}
<span style="color:#8e44ad">{% for</span><span style="color:#8e44ad"> item in item_list </span><span style="color:#8e44ad">%}</span>
<span style="font-weight:bold"><h2></span>
<span style="font-weight:bold"><a</span><span style="color:#27ae60"> href=</span><span style="color:#f44f4f">"</span><span style="color:#8e44ad">{{ item.get_absolute_url }}</span><span style="color:#f44f4f">"</span><span style="font-weight:bold">></span>
<span style="color:#8e44ad">{{ item.text }}</span>
<span style="color:#8e44ad">{{ item.other_text</span><span style="color:#27ae60">|upper </span><span style="color:#8e44ad">}}</span>
<span style="font-weight:bold"></a></span>
<span style="font-weight:bold"></h2></span>
<span style="font-weight:bold"><p></span><span style="color:#8e44ad">{{ story.longer_text</span><span style="color:#27ae60">|truncatewords:</span><span style="color:#f44f4f">"100"</span><span style="color:#27ae60"> </span><span style="color:#8e44ad">}}</span><span style="font-weight:bold"></p></span>
<span style="color:#8e44ad">{% endfor %}</span>
<span style="color:#8e44ad">{% endblock %}</span>
{# For loop example with specific content if empty #}
<span style="color:#8e44ad">{% for</span><span style="color:#8e44ad"> item in other_list </span><span style="color:#8e44ad">%}</span>
<span style="font-weight:bold"><h2></span>
<span style="color:#8e44ad">{{ item.text }}</span>
<span style="font-weight:bold"></h2></span>
<span style="color:#8e44ad">{% else</span><span style="color:#8e44ad"> </span><span style="color:#8e44ad">%}</span>
<span style="font-weight:bold"><h2></span>
This list is empty
<span style="font-weight:bold"></h2></span>
<span style="color:#8e44ad">{% endfor %}</span>
<span style="color:#da4453;text-decoration:underline">{% endblock %}</span>
{# if example #}
<span style="color:#8e44ad">{% if</span><span style="color:#8e44ad"> item_list </span><span style="color:#8e44ad">%}</span>
Number of items: <span style="color:#8e44ad">{{ item_list</span><span style="color:#27ae60">|length </span><span style="color:#8e44ad">}}</span>
<span style="color:#8e44ad">{% elif</span><span style="color:#8e44ad"> some_condition </span><span style="color:#8e44ad">%}</span>
Show this text
<span style="color:#8e44ad">{% else</span><span style="color:#8e44ad"> </span><span style="color:#8e44ad">%}</span>
Nothing to process
<span style="color:#8e44ad">{% endif %}</span>
{# This is a comment #} hello comment
{# Translation example #}
<span style="color:#8e44ad">{% translate</span><span style="color:#8e44ad"> </span><span style="color:#f44f4f">"Title"</span><span style="color:#8e44ad"> as title </span><span style="color:#8e44ad">%}</span>
<span style="color:#8e44ad">{% block</span><span style="color:#8e44ad"> content </span><span style="color:#8e44ad">%}</span><span style="color:#8e44ad">{{ title }}</span><span style="color:#8e44ad">{% endblock %}</span>
{# Auto-escaping #}
<span style="color:#8e44ad">{% autoescape</span><span style="color:#8e44ad"> off </span><span style="color:#8e44ad">%}</span>
Hello <span style="color:#8e44ad">{{ name }}</span>
<span style="color:#8e44ad">{% endautoescape %}</span>
{# Loading custom tags/libraries #}
<span style="color:#8e44ad">{% load</span><span style="color:#8e44ad"> humanize </span><span style="color:#8e44ad">%}</span>
</pre></body></html>
|