| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 {% macro description(key_name, open="<p>", close="</p>") %} | 1 {# |
| 2 {% for i in range(100) %} | 2 # This file is part of the Adblock Plus website, |
| 3 {% if i == 0 and key_name in localedata %} | 3 # Copyright (C) 2006-2015 Eyeo GmbH |
| 4 {{open |safe}}{{ key_name |translate(None, links[key_name])|unescape|safe }}{{close |safe}} | 4 # |
|
Sebastian Noack
2015/02/13 17:51:49
If you output the "open" and "close" variables out
kzar
2015/02/20 14:55:18
Both the unescape and safe filters are required he
Sebastian Noack
2015/02/20 15:32:59
I think I figured out the issue here. It look like
| |
| 5 {% elif (key_name + i|string) in localedata %} | 5 # Adblock Plus is free software: you can redistribute it and/or modify |
|
Sebastian Noack
2015/02/13 17:51:49
Maybe using {% set %} instead duplicating the logi
kzar
2015/02/20 14:55:18
Done.
| |
| 6 {{open |safe}}{{ (key_name + i|string) |translate(None, links[key_name])|u nescape|safe }}{{close |safe}} | 6 # it under the terms of the GNU General Public License version 3 as |
| 7 {% endif %} | 7 # published by the Free Software Foundation. |
| 8 {% endfor %} | 8 # |
| 9 {% endmacro %} | 9 # Adblock Plus is distributed in the hope that it will be useful, |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 # GNU General Public License for more details. | |
| 13 # | |
| 14 # You should have received a copy of the GNU General Public License | |
| 15 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 #} | |
| 10 | 17 |
| 11 {% macro return_type(return_type) %} | 18 {% macro return_type(return_type) %} |
| 12 {% if return_type |truncate(1, True, "") == "I" %} | 19 {% if return_type|truncate(1, True, "") == "I" %} |
| 13 {{ return_type |linkify }} | 20 {{ return_type|linkify }} |
| 14 {{ return_type -}} | 21 {{ return_type -}} |
| 15 </a> | 22 </a> |
| 16 {% else %} | 23 {% else %} |
| 17 {{ return_type }} | 24 {{ return_type }} |
| 18 {% endif %} | 25 {% endif %} |
| 19 {% endmacro %} | 26 {% endmacro %} |
| 20 | 27 |
| 21 {% block body %} | 28 {% macro display_interface(interface, links) %} |
| 22 {% set interface=interface|parse_interface %} | 29 {% set interface=interface|parse_interface %} |
| 23 | 30 |
| 24 <h2>{{ "methods_and_properties" |translate }}</h2> | 31 <h2>{{ "toc_header"|translate }}</h2> |
| 25 <ul> | 32 <ul> |
| 26 {% for property in interface %} | 33 {% for property in interface %} |
| 27 {% if property.type == "method" %} | 34 {% if property.type == "method" %} |
| 28 <li> | 35 <li> |
| 29 {{ return_type(property.return_type) }} | 36 {{ return_type(property.return_type) }} |
| 30 <a href="#method_{{ property.name }}" class="methodname">{{ property.n ame }}</a> | 37 <a href="#method_{{ property.name }}" class="methodname">{{ property.n ame }}</a> |
| 31 ( | 38 ( |
| 32 {% for argument in property.arguments %} | 39 {% for argument in property.arguments %} |
| 33 {{ argument.type }} {{argument.name }} | 40 {{ argument.type }} {{argument.name }} |
| 34 {%- if not loop.last %},{% endif %} | 41 {%- if not loop.last %},{% endif %} |
| 35 {% endfor %} | 42 {% endfor %} |
| 36 ) | 43 ) |
| 37 </li> | 44 </li> |
| 38 {% else %} | 45 {% else %} |
| 39 <li> | 46 <li> |
| 40 {{ property.modifier }} {{ property.type }} | 47 {{ property.modifier }} {{ property.type }} |
| 41 <a href="#prop_{{ property.name }}" class="propname">{{ property.name }} </a> | 48 <a href="#prop_{{ property.name }}" class="propname">{{ property.name }} </a> |
| 42 </li> | 49 </li> |
| 43 {% endif %} | 50 {% endif %} |
| 44 {% endfor %} | 51 {% endfor %} |
| 45 </ul> | 52 </ul> |
| 46 | 53 |
| 47 {% for property in interface %} | 54 {% for property in interface %} |
| 55 <hr> | |
| 48 {% if property.type == "method" %} | 56 {% if property.type == "method" %} |
| 49 <hr> | |
| 50 <p id="method_{{ property.name }}"> | 57 <p id="method_{{ property.name }}"> |
| 51 {{ return_type(property.return_type) }} | 58 {{ return_type(property.return_type) }} |
| 52 <span class="methodname">{{ property.name }}</span> | 59 <span class="methodname">{{ property.name }}</span> |
| 53 ( | 60 ( |
| 54 {% for argument in property.arguments %} | 61 {% for argument in property.arguments %} |
| 55 {{ argument.modifier }} {{ argument.type }} {{ argument.name }} | 62 {{ argument.modifier }} {{ argument.type }} {{ argument.name }} |
| 56 {%- if not loop.last %},{% endif %} | 63 {%- if not loop.last %},{% endif %} |
| 57 {% endfor %} | 64 {% endfor %} |
| 58 ) | 65 ) |
| 59 </p> | 66 </p> |
| 60 {{ description(property.name + "Description") }} | 67 {{ property.description() }} |
| 61 <dl> | 68 <dl> |
| 62 {% if property.version %} | 69 {% if property.version %} |
| 63 <dt>Version:</dt> | 70 <dt>Version:</dt> |
| 64 <dd>{{ property.version }} and higher</dd> | 71 <dd>{{ property.version }} and higher</dd> |
| 65 {% endif %} | 72 {% endif %} |
| 66 {% if property.arguments |length %} | 73 {% if property.arguments|length %} |
| 67 <dt>Arguments:</dt> | 74 <dt>Arguments:</dt> |
| 68 {% for argument in property.arguments %} | 75 {% for argument in property.arguments %} |
| 69 <dd> | 76 <dd> |
| 70 <span class="argumentname">{{ argument.name }}</span>: | 77 <span class="argumentname">{{ argument.name }}</span>: |
| 71 {{ description(property.name + "Argument" + argument.name + "Descr iption", "", "") }} | 78 {{ property["description-" + argument.name]() }} |
| 72 </dd> | 79 </dd> |
| 73 {% endfor %} | 80 {% endfor %} |
| 74 {% endif %} | 81 {% endif %} |
| 75 {% if (property.name + "ReturnDescription") in localedata %} | 82 {% if "description-return" in property %} |
| 76 <dt>Returns:</dt> | 83 <dt>Returns:</dt> |
| 77 <dd>{{ (property.name + "ReturnDescription") |translate(None, links[pr operty.name + "ReturnDescription"])|unescape|safe }}</dd> | 84 <dd>{{ property["description-return"]() }}</dd> |
| 78 {% endif %} | 85 {% endif %} |
| 79 </dl> | 86 </dl> |
| 80 {% else %} | 87 {% else %} |
| 81 <hr> | |
| 82 <p id="prop_{{ property.name }}"> | 88 <p id="prop_{{ property.name }}"> |
| 83 {{ property.modifier }} {{ property.type }} | 89 {{ property.modifier }} {{ property.type }} |
| 84 <span class="propname">{{ property.name }}</span> | 90 <span class="propname">{{ property.name }}</span> |
| 85 </p> | 91 </p> |
| 86 <p>{{ description(property.name + "Description") }}</p> | 92 {{ property.description() }} |
|
Sebastian Noack
2015/02/13 17:51:49
Mind that the "description" macro is already gener
kzar
2015/02/20 14:55:18
Done.
| |
| 87 {% endif %} | 93 {% endif %} |
| 88 {% endfor %} | 94 {% endfor %} |
| 89 {% endblock %} | 95 {% endmacro %} |
| LEFT | RIGHT |