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