| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 4 |
<title>highlight_django.html</title> |
| 5 |
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Django HTML Template) - Theme (Breeze Dark)"/> |
| 6 |
</head><body style="background-color:#232629;color:#cfcfc2"><pre> |
| 7 |
{# Basic extension of a common file #} |
| 8 |
<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> |
| 9 |
|
| 10 |
<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> |
| 11 |
|
| 12 |
<span style="color:#8e44ad;">{% block</span><span style="color:#8e44ad;"> content </span><span style="color:#8e44ad;">%}</span> |
| 13 |
<span style="font-weight:bold;"><h1></span><span style="color:#8e44ad;">{{ section.title }}</span><span style="font-weight:bold;"></h1></span> |
| 14 |
|
| 15 |
{# For loop example #} |
| 16 |
|
| 17 |
<span style="color:#8e44ad;">{% for</span><span style="color:#8e44ad;"> item in item_list </span><span style="color:#8e44ad;">%}</span> |
| 18 |
<span style="font-weight:bold;"><h2></span> |
| 19 |
<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> |
| 20 |
<span style="color:#8e44ad;">{{ item.text }}</span> |
| 21 |
<span style="color:#8e44ad;">{{ item.other_text</span><span style="color:#27ae60;">|upper </span><span style="color:#8e44ad;">}}</span> |
| 22 |
<span style="font-weight:bold;"></a></span> |
| 23 |
<span style="font-weight:bold;"></h2></span> |
| 24 |
<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> |
| 25 |
<span style="color:#8e44ad;">{% endfor %}</span> |
| 26 |
<span style="color:#8e44ad;">{% endblock %}</span> |
| 27 |
|
| 28 |
|
| 29 |
{# For loop example with specific content if empty #} |
| 30 |
|
| 31 |
<span style="color:#8e44ad;">{% for</span><span style="color:#8e44ad;"> item in other_list </span><span style="color:#8e44ad;">%}</span> |
| 32 |
<span style="font-weight:bold;"><h2></span> |
| 33 |
<span style="color:#8e44ad;">{{ item.text }}</span> |
| 34 |
<span style="font-weight:bold;"></h2></span> |
| 35 |
<span style="color:#8e44ad;">{% else</span><span style="color:#8e44ad;"> </span><span style="color:#8e44ad;">%}</span> |
| 36 |
<span style="font-weight:bold;"><h2></span> |
| 37 |
This list is empty |
| 38 |
<span style="font-weight:bold;"></h2></span> |
| 39 |
<span style="color:#8e44ad;">{% endfor %}</span> |
| 40 |
<span style="color:#da4453;text-decoration:underline;">{% endblock %}</span> |
| 41 |
|
| 42 |
|
| 43 |
{# if example #} |
| 44 |
|
| 45 |
<span style="color:#8e44ad;">{% if</span><span style="color:#8e44ad;"> item_list </span><span style="color:#8e44ad;">%}</span> |
| 46 |
Number of items: <span style="color:#8e44ad;">{{ item_list</span><span style="color:#27ae60;">|length </span><span style="color:#8e44ad;">}}</span> |
| 47 |
<span style="color:#8e44ad;">{% elif</span><span style="color:#8e44ad;"> some_condition </span><span style="color:#8e44ad;">%}</span> |
| 48 |
Show this text |
| 49 |
<span style="color:#8e44ad;">{% else</span><span style="color:#8e44ad;"> </span><span style="color:#8e44ad;">%}</span> |
| 50 |
Nothing to process |
| 51 |
<span style="color:#8e44ad;">{% endif %}</span> |
| 52 |
|
| 53 |
{# This is a comment #} hello comment |
| 54 |
|
| 55 |
|
| 56 |
{# Translation example #} |
| 57 |
|
| 58 |
<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> |
| 59 |
<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> |
| 60 |
|
| 61 |
|
| 62 |
{# Auto-escaping #} |
| 63 |
|
| 64 |
<span style="color:#8e44ad;">{% autoescape</span><span style="color:#8e44ad;"> off </span><span style="color:#8e44ad;">%}</span> |
| 65 |
Hello <span style="color:#8e44ad;">{{ name }}</span> |
| 66 |
<span style="color:#8e44ad;">{% endautoescape %}</span> |
| 67 |
|
| 68 |
|
| 69 |
{# Loading custom tags/libraries #} |
| 70 |
|
| 71 |
<span style="color:#8e44ad;">{% load</span><span style="color:#8e44ad;"> humanize </span><span style="color:#8e44ad;">%}</span> |
| 72 |
</pre></body></html> |