Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: includes/interface.tmpl

Issue 5636796054503424: Issue 1170 - [adblockplus.org Anwiki to CMS migration] Migrate content (Closed)
Patch Set: Removed redundant safe filters Created Feb. 23, 2015, 7:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 {#
2 # This file is part of the Adblock Plus website,
3 # Copyright (C) 2006-2015 Eyeo GmbH
4 #
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
7 # published by the Free Software Foundation.
8 #
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 #}
17
18 {% macro description(key_name, open="<p>", close="</p>") %}
Wladimir Palant 2015/02/24 20:19:40 Nit: Looking at how this macro is used, having ope
kzar 2015/02/26 19:50:17 Done.
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 %}
Wladimir Palant 2015/02/24 20:19:40 Nit: Why the space trimming here? We don't do it e
kzar 2015/02/26 19:50:17 Since I refactored this code the trimming no longe
25 {% if current_key_name in localedata %}
26 {{open|safe}}{{ current_key_name|translate(None, links[key_name]) }}{{clos e|safe}}
Wladimir Palant 2015/02/24 20:19:40 Why are links a separate variable rather than part
kzar 2015/02/26 19:50:17 Well I think because it's not that simple. Interfa
Wladimir Palant 2015/02/26 20:35:03 Fair enough. Having links in a separate data struc
27 {% endif %}
28 {% endfor %}
29 {% endmacro %}
30
31 {% macro return_type(return_type) %}
32 {% if return_type|truncate(1, True, "") == "I" %}
33 {{ return_type|linkify }}
34 {{ return_type -}}
Wladimir Palant 2015/02/24 20:19:40 Nit: Again, why the space trimming here? It should
kzar 2015/02/26 19:50:17 This one is required, otherwise the link has a tra
35 </a>
36 {% else %}
37 {{ return_type }}
38 {% endif %}
39 {% endmacro %}
40
41 {% block body %}
42 {% set interface=interface|parse_interface %}
Wladimir Palant 2015/02/24 20:19:40 I seriously dislike how this passes parameters via
kzar 2015/02/26 19:50:17 Done.
43
44 <h2>{{ "methods_and_properties"|translate }}</h2>
Wladimir Palant 2015/02/24 20:19:40 Nit: Call this string "toc_header"? The string ide
kzar 2015/02/26 19:50:17 Done.
45 <ul>
46 {% for property in interface %}
47 {% if property.type == "method" %}
48 <li>
49 {{ return_type(property.return_type) }}
50 <a href="#method_{{ property.name }}" class="methodname">{{ property.n ame }}</a>
51 (
52 {% for argument in property.arguments %}
53 {{ argument.type }} {{argument.name }}
54 {%- if not loop.last %},{% endif %}
55 {% endfor %}
56 )
57 </li>
58 {% else %}
59 <li>
60 {{ property.modifier }} {{ property.type }}
61 <a href="#prop_{{ property.name }}" class="propname">{{ property.name }} </a>
62 </li>
63 {% endif %}
64 {% endfor %}
65 </ul>
66
67 {% for property in interface %}
68 {% if property.type == "method" %}
69 <hr>
Wladimir Palant 2015/02/24 20:19:40 Nit: Move <hr> out of the if block? We need a sepa
kzar 2015/02/26 19:50:17 Done.
70 <p id="method_{{ property.name }}">
71 {{ return_type(property.return_type) }}
72 <span class="methodname">{{ property.name }}</span>
73 (
74 {% for argument in property.arguments %}
75 {{ argument.modifier }} {{ argument.type }} {{ argument.name }}
76 {%- if not loop.last %},{% endif %}
77 {% endfor %}
78 )
79 </p>
80 {{ description(property.name + "Description") }}
81 <dl>
82 {% if property.version %}
83 <dt>Version:</dt>
84 <dd>{{ property.version }} and higher</dd>
Wladimir Palant 2015/02/24 20:19:40 The two strings above should be translated.
kzar 2015/02/26 19:50:17 I agree but it's not currently and this issue is t
Wladimir Palant 2015/02/26 20:35:03 Heh, fair enough.
kzar 2015/02/26 21:49:13 Cool, I've filed an issue https://issues.adblockpl
85 {% endif %}
86 {% if property.arguments|length %}
87 <dt>Arguments:</dt>
Wladimir Palant 2015/02/24 20:19:40 This string should be translated.
kzar 2015/02/26 19:50:17 See above.
88 {% for argument in property.arguments %}
89 <dd>
90 <span class="argumentname">{{ argument.name }}</span>:
91 {{ description(property.name + "Argument" + argument.name + "Descr iption", "", "") }}
Wladimir Palant 2015/02/24 20:19:40 "updateExternalSubscriptionArgumenttitleDescriptio
kzar 2015/02/26 19:50:17 Done.
92 </dd>
93 {% endfor %}
94 {% endif %}
95 {% if (property.name + "ReturnDescription") in localedata %}
96 <dt>Returns:</dt>
Wladimir Palant 2015/02/24 20:19:40 This string should be translated.
kzar 2015/02/26 19:50:17 See above.
97 <dd>{{ (property.name + "ReturnDescription")|translate(None, links[pro perty.name + "ReturnDescription"]) }}</dd>
Wladimir Palant 2015/02/24 20:19:40 Why not use the description() macro here? You did
kzar 2015/02/26 19:50:17 Done.
98 {% endif %}
99 </dl>
100 {% else %}
101 <hr>
102 <p id="prop_{{ property.name }}">
103 {{ property.modifier }} {{ property.type }}
104 <span class="propname">{{ property.name }}</span>
105 </p>
106 {{ description(property.name + "Description") }}
107 {% endif %}
108 {% endfor %}
109 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld