LEFT | RIGHT |
1 {%- macro processSubscription(subscription, parent=None) %} | 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 process_subscription(subscription, parent=None) %} |
2 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> | 19 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> |
3 {%- if subscription["supplements"] %} | 20 {%- if subscription["supplements"] %} |
4 <td rowspan="2" class="dummy"></td><td rowspan="2"> | 21 <td rowspan="2" class="dummy"></td> |
| 22 <td rowspan="2"> |
5 {%- else %} | 23 {%- else %} |
6 <td rowspan="2" colspan="2"> | 24 <td rowspan="2" colspan="2"> |
7 {%- endif %} | 25 {%- endif %} |
8 <strong class="subscriptionTitle">{{subscription["name"]}}</strong><br /> | 26 <strong class="subscriptionTitle">{{ subscription["name"] }}</strong><br> |
9 {{subscription["specialization"]}} | 27 {{ subscription["specialization"] }} |
10 {%- if subscription["supplements"] %} | 28 {%- if subscription["supplements"] %} |
11 <br />{{ "supplements_prefix" |translate }} {{' / '.join(subscription["sup
plements"])}} {{ "supplements_suffix" |translate }} | 29 <br>{{ "supplements_prefix"|translate }} {{ ' / '.join(subscription["suppl
ements"]) }} {{ "supplements_suffix"|translate }} |
12 {%- endif %} | 30 {%- endif %} |
13 </td> | 31 </td> |
14 <td> | 32 <td> |
15 {%- if subscription["maintainer"] %} | 33 {%- if subscription["maintainer"] %} |
16 {{ "maintainer_prefix" |translate }} {{subscription["maintainer"]}} {{ "ma
intainer_suffix" |translate }}<br /> | 34 {{ "maintainer_prefix"|translate }} {{ subscription["maintainer"] }} {{ "m
aintainer_suffix"|translate }}<br> |
17 {%- endif %} | 35 {%- endif %} |
18 {%- set isFirst = True %} | 36 {%- set is_first = True %} |
19 {% for key in ('homepage', 'forum', 'contact', 'faq', 'blog', 'changelog',
'policy') -%} | 37 {% for key in ('homepage', 'forum', 'contact', 'faq', 'blog', 'changelog',
'policy') -%} |
20 {%- set url = subscription[key] -%} | 38 {%- set url = subscription[key] -%} |
21 {%- if url -%} | 39 {%- if url -%} |
22 {%- if not isFirst %}, {% endif -%} | 40 {%- if not is_first %}, {% endif -%} |
23 {%- set isFirst = False -%} | 41 {%- set is_first = False -%} |
24 <a href="{{url}}">{{key |translate}}</a> | 42 <a href="{{ url }}">{{ key|translate }}</a> |
25 {%- endif %} | 43 {%- endif %} |
26 {%- endfor %} | 44 {%- endfor %} |
27 </td> | 45 </td> |
28 </tr> | 46 </tr> |
29 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> | 47 <tr{% if subscription["deprecated"] %} class="deprecated"{% endif %}> |
30 <td> | 48 <td> |
31 {%- if subscription["deprecated"] %} | 49 {%- if subscription["deprecated"] %} |
32 <strong>{{ "deprecation_warning" |translate }}</strong><br /> | 50 <strong>{{ "deprecation_warning"|translate }}</strong><br> |
33 {%- endif %} | 51 {%- endif %} |
34 {{ "subscribe" |translate}}{{' '}} | 52 {{ "subscribe"|translate }}{{ ' ' }} |
35 {%- for title, url, complete in subscription["variants"] -%} | 53 {%- for title, url, complete in subscription["variants"] -%} |
36 <a href="abp:subscribe?location={{url|urlencode}}&title={{title|urle
ncode}} | 54 <a href="abp:subscribe?location={{ url|urlencode }}&title={{ title|u
rlencode }} |
37 {%- if parent and not complete -%} | 55 {%- if parent and not complete -%} |
38 {%- set mainTitle, mainURL, mainComplete = parent.variants[0] -%} | 56 {%- set main_title, main_url, main_complete = parent.variants[0] -%} |
39 &requiresLocation={{mainURL|urlencode}}&requiresTitle={{main
Title|urlencode}} | 57 &requiresLocation={{ main_url|urlencode }}&requiresTitle={{
main_title|urlencode }} |
40 {%- endif -%} | 58 {%- endif -%} |
41 ">{{title}}</a>{%- if not loop.last %}, {% endif -%} | 59 ">{{ title }}</a>{%- if not loop.last %}, {% endif -%} |
42 {%- endfor %} | 60 {%- endfor %} |
43 </td> | 61 </td> |
44 </tr> | 62 </tr> |
45 {%- if not parent -%} | 63 {%- if not parent -%} |
46 {%- for supplement in subscription["supplemented"] |subscription_sort -%} | 64 {%- for supplement in subscription["supplemented"]|subscription_sort -%} |
47 {{ processSubscription(supplement, subscription) }} | 65 {{ process_subscription(supplement, subscription) }} |
48 {%- endfor -%} | 66 {%- endfor -%} |
49 {%- endif -%} | 67 {%- endif -%} |
50 {%- endmacro %} | 68 {%- endmacro %} |
51 | 69 |
52 {%- set currentType = subscriptions[0]["type"] -%} | 70 {% macro display_subscriptions(subscriptions) %} |
53 <h2>{{ ("type_" + currentType) |translate }}</h2> | 71 {%- set current_type = subscriptions[0]["type"] -%} |
| 72 <h2>{{ ("type_" + current_type)|translate }}</h2> |
54 | 73 |
55 <table class="subscriptions"> | 74 <table class="subscriptions"> |
56 {%- for subscription in subscriptions |subscription_sort -%} | 75 {%- for subscription in subscriptions|subscription_sort -%} |
57 {%- if not subscription["supplements"] -%} | 76 {%- if not subscription["supplements"] -%} |
58 {%- if currentType != subscription["type"] -%} | 77 {%- if current_type != subscription["type"] -%} |
59 {%- set currentType = subscription["type"] %} | 78 {%- set current_type = subscription["type"] %} |
60 </table> | 79 </table> |
61 | 80 |
62 <h2>{{ ("type_" + currentType) |translate }}</h2> | 81 <h2>{{ ("type_" + current_type)|translate }}</h2> |
63 | 82 |
64 <table class="subscriptions"> | 83 <table class="subscriptions"> |
| 84 {%- endif -%} |
| 85 {{ process_subscription(subscription) }} |
65 {%- endif -%} | 86 {%- endif -%} |
66 {{ processSubscription(subscription) }} | 87 {%- endfor %} |
67 {%- endif -%} | 88 </table> |
68 {%- endfor %} | 89 {% endmacro %} |
69 </table> | |
LEFT | RIGHT |