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

Delta Between Two Patch Sets: includes/interface.tmpl

Issue 5636796054503424: Issue 1170 - [adblockplus.org Anwiki to CMS migration] Migrate content (Closed)
Left Patch Set: Removed redundant safe filters Created Feb. 23, 2015, 7:43 p.m.
Right Patch Set: Remove includes/common.tmpl which is no longer required. Created March 7, 2015, 7:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « includes/index.tmpl ('k') | includes/preftable.tmpl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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>") %}
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) %} 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 -}}
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> 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 %}
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 30
44 <h2>{{ "methods_and_properties"|translate }}</h2> 31 <h2>{{ "toc_header"|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> 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>
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 }}"> 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>
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 %} 72 {% endif %}
86 {% if property.arguments|length %} 73 {% if property.arguments|length %}
87 <dt>Arguments:</dt> 74 <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 %} 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]() }}
Wladimir Palant 2015/02/24 20:19:40 "updateExternalSubscriptionArgumenttitleDescriptio
kzar 2015/02/26 19:50:17 Done.
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>
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> 84 <dd>{{ property["description-return"]() }}</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 %} 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 %}
LEFTRIGHT

Powered by Google App Engine
This is Rietveld