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

Unified Diff: includes/interface.tmpl

Issue 5636796054503424: Issue 1170 - [adblockplus.org Anwiki to CMS migration] Migrate content (Closed)
Patch Set: Brought in changes to website made over last few months. Created Jan. 19, 2015, 12:18 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: includes/interface.tmpl
diff --git a/includes/interface.tmpl b/includes/interface.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..190658bfbf7579db660a073dd259677f841657f3
--- /dev/null
+++ b/includes/interface.tmpl
@@ -0,0 +1,89 @@
+{% macro description(key_name, open="<p>", close="</p>") %}
+ {% for i in range(100) %}
+ {% if i == 0 and key_name in localedata %}
+ {{open |safe}}{{ key_name |translate(None, links[key_name])|unescape|safe }}{{close |safe}}
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
+ {% elif (key_name + i|string) in localedata %}
Sebastian Noack 2015/02/13 17:51:49 Maybe using {% set %} instead duplicating the logi
kzar 2015/02/20 14:55:18 Done.
+ {{open |safe}}{{ (key_name + i|string) |translate(None, links[key_name])|unescape|safe }}{{close |safe}}
+ {% endif %}
+ {% endfor %}
+{% endmacro %}
+
+{% macro return_type(return_type) %}
+ {% if return_type |truncate(1, True, "") == "I" %}
+ {{ return_type |linkify }}
+ {{ return_type -}}
+ </a>
+ {% else %}
+ {{ return_type }}
+ {% endif %}
+{% endmacro %}
+
+{% block body %}
+ {% set interface=interface|parse_interface %}
+
+ <h2>{{ "methods_and_properties" |translate }}</h2>
+ <ul>
+ {% for property in interface %}
+ {% if property.type == "method" %}
+ <li>
+ {{ return_type(property.return_type) }}
+ <a href="#method_{{ property.name }}" class="methodname">{{ property.name }}</a>
+ (
+ {% for argument in property.arguments %}
+ {{ argument.type }} {{argument.name }}
+ {%- if not loop.last %},{% endif %}
+ {% endfor %}
+ )
+ </li>
+ {% else %}
+ <li>
+ {{ property.modifier }} {{ property.type }}
+ <a href="#prop_{{ property.name }}" class="propname">{{ property.name }}</a>
+ </li>
+ {% endif %}
+ {% endfor %}
+ </ul>
+
+ {% for property in interface %}
+ {% if property.type == "method" %}
+ <hr>
+ <p id="method_{{ property.name }}">
+ {{ return_type(property.return_type) }}
+ <span class="methodname">{{ property.name }}</span>
+ (
+ {% for argument in property.arguments %}
+ {{ argument.modifier }} {{ argument.type }} {{ argument.name }}
+ {%- if not loop.last %},{% endif %}
+ {% endfor %}
+ )
+ </p>
+ {{ description(property.name + "Description") }}
+ <dl>
+ {% if property.version %}
+ <dt>Version:</dt>
+ <dd>{{ property.version }} and higher</dd>
+ {% endif %}
+ {% if property.arguments |length %}
+ <dt>Arguments:</dt>
+ {% for argument in property.arguments %}
+ <dd>
+ <span class="argumentname">{{ argument.name }}</span>:
+ {{ description(property.name + "Argument" + argument.name + "Description", "", "") }}
+ </dd>
+ {% endfor %}
+ {% endif %}
+ {% if (property.name + "ReturnDescription") in localedata %}
+ <dt>Returns:</dt>
+ <dd>{{ (property.name + "ReturnDescription") |translate(None, links[property.name + "ReturnDescription"])|unescape|safe }}</dd>
+ {% endif %}
+ </dl>
+ {% else %}
+ <hr>
+ <p id="prop_{{ property.name }}">
+ {{ property.modifier }} {{ property.type }}
+ <span class="propname">{{ property.name }}</span>
+ </p>
+ <p>{{ description(property.name + "Description") }}</p>
Sebastian Noack 2015/02/13 17:51:49 Mind that the "description" macro is already gener
kzar 2015/02/20 14:55:18 Done.
+ {% endif %}
+ {% endfor %}
+{% endblock %}

Powered by Google App Engine
This is Rietveld