1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
---
layout: base
docs_tab: true
analytics_id: {{site.ganalytics}}
scripts:
- lib/raphael-min.js
- lib/underscore-min.js
- lib/sequence-diagram-min.js
- lib/flowchart-latest.js
- process-uml.js
---
{% include header.html %}
{% comment %}
set some constants
{% endcomment %}
{% assign ALL_PAGES = site.data.all-pages %}
{% assign DOCSDIR = site.docsurl %}
{% assign TOCSDIR = site.data.tocs %}
{% assign TOCFILE = TOCSDIR[page.tocdir][page.tocfile] %}
{% capture VERSION_ROOT %}{{DOCSDIR}}/{{page.tocdir}}/{{ page.language }}/{{ page.version }}/{% endcapture %}
{% capture LANGUAGE_ROOT %}{{DOCSDIR}}/{{page.tocdir}}/{{ page.language }}/{% endcapture %}
{% assign MY_ENTRY = page.url | replace: VERSION_ROOT,"" %}
{% assign my_entry_parts = MY_ENTRY | split: "/" %}
<div class="docs container">
<!-- Table of Contents -->
<div class="hidden-xs hidden-sm col-md-4 col-lg-3 site-toc-container">
{% include toc_recursive_main.html entries=TOCFILE my_entry=MY_ENTRY version_root=VERSION_ROOT %}
</div>
<!-- Page content -->
<div class="col-md-8 col-md-offset-4 col-lg-9 col-lg-offset-3 page-content-container container">
<div class="page-content row">
<div class="col-md-offset-1 col-md-10">
<div class="content-header">
<!-- ToC Dropdown (for XS and SM sizes only) -->
<div class="toc-dropdown dropdown visible-xs-block visible-sm-block">
<button class="btn btn-default dropdown-toggle" type="button" id="tocDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ page.toc_text }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% include toc_recursive_dropdown.html entries=TOCFILE my_entry=MY_ENTRY version_root=VERSION_ROOT %}
</ul>
</div>
<!--
{% comment %}
Show a single edit-link if the page has a specific edit-link.
{% endcomment %}
{% if page.edit_link %}
<a class="edit" href="{{ page.edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_text }}</a>
{% comment %}
Otherwise, show editing and translating options.
Edit-links obey the following rules:
if page in /master/ or /latest/:
show edit link for /master/ page in source language
if page not in source language:
show translation link for /master/ page
else:
show edit link for the page in its version and language
{% endcomment %}
{% else %}
{% capture base_edit_link %}{{ site.urls.edit_git }}{{ page.path }}{% endcapture %}
{% capture base_version %}/{{ page.version }}/{% endcapture %}
{% capture base_language %}/{{ page.language }}/{% endcapture %}
{% capture master_version %}/master/{% endcapture %}
{% capture src_language %}/{{ site.src_language }}/{% endcapture %}
{% comment %}
Edit-links for current pages in non-source languages
NOTE:
Pages that are under /master/ or /latest/ (i.e. site.latest_docs_version) have page.current set to "true".
{% endcomment %}
{% if page.language != site.src_language and page.current %}
{% comment %}
Compute crowdin link
{% endcomment %}
{% capture page_path_prefix %}docs/{{ page.language }}/{{ page.version }}{% endcapture %}
{% assign page_path_end = page.path | split:"/" | last %}
{% assign crowdin_path = page.path | replace:page_path_prefix,"docs/en/master" | replace:page_path_end,"" %}
{% capture crowdin_link %}https://crowdin.com/project/cordova/{{ page.language }}#/cordova-docs/{{ crowdin_path }}{% endcapture %}
{% assign edit_link = base_edit_link | replace:base_language,src_language | replace:base_version,master_version %}
<a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
<a class="edit" href="{{ crowdin_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_translation_text }}</a>
{% comment %}
Edit-links for all other pages
{% endcomment %}
{% else %}
{% comment %}
Edit-link for latest version points to master instead
{% endcomment %}
{% if page.version == site.latest_docs_version %}
{% assign edit_link = base_edit_link | replace:base_version,master_version %}
{% else %}
{% assign edit_link = base_edit_link %}
{% endif %}
<a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
{% endif %}
{% endif %}
-->
<!-- Language dropdown -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="languageDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ site.data.docs-versions[page.language].name }}
<span class="caret"></span>
</button>
<!-- List all languages -->
<ul class="dropdown-menu" aria-labelledby="languageDropdown">
{% for other_language_entry in site.data.docs-versions %}
{% assign other_language_id = other_language_entry[0] %}
{% assign other_language = other_language_entry[1] %}
{% assign other_language_versions = other_language.versions %}
{% assign other_language_name = other_language.name %}
{% capture other_language_root %}/docs/{{ other_language_id }}/{% endcapture %}
{% comment %}
Replace only the language part of the URI, thereby redirecting to the same page
in the other language. The page will exist because translations are clones of each other.
{% endcomment %}
{% assign other_language_url = page.url | replace:LANGUAGE_ROOT,other_language_root %}
<li>
<a href="{{ site.baseurl }}{{ other_language_url }}" class="{% unless other_language_versions contains page.version %}missing-page{% endunless %}">
{% if page.language == other_language_id %}
<span class="selected">
{{ other_language_name }}
</span>
{% else %}
{{ other_language_name }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
<!-- Version dropdown -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="versionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ page.version }}
{% if page.version == site.latest_docs_version %}
({{ page.latest_text }})
{% endif %}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="versionDropdown">
<!-- List versions available in this language -->
{% for other_version in site.data.docs-versions[page.language].versions reversed %}
<li>
{% comment %}
Name the latest version as "latest" to take advantage of redirects for "/latest/".
{% endcomment %}
{% if other_version == site.latest_docs_version %}
{% assign other_version_string = "latest" %}
{% else %}
{% assign other_version_string = other_version %}
{% endif %}
{% capture version_entry_string %}
{{ other_version }}
{% if other_version == site.latest_docs_version %}
({{ page.latest_text }})
{% endif %}
{% endcapture %}
{% comment %}
Replace only the version part of the URI, thereby redirecting to
the same page in the other version.
NOTE:
This page might not exist in the target version because page
layouts change from version to version
{% endcomment %}
{% capture other_version_root %}/docs/{{ page.language }}/{{ other_version_string }}/{% endcapture %}
{% assign other_version_url = page.url | replace:VERSION_ROOT,other_version_root %}
{% unless ALL_PAGES contains other_version_url %}
{% assign other_version_url = other_version_root %}
{% endunless %}
<a href="{{ site.docsurl }}{{ other_version_url }}" class="{% unless ALL_PAGES contains other_version_url %}missing-page{% endunless %}">
{% if page.version == other_version %}
<span class="selected">
{{ version_entry_string }}
</span>
{% else %}
{{ version_entry_string }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% comment %}
Get URL for this page in the latest version
{% endcomment %}
{% capture latest_root %}/docs/{{ page.language }}/latest/{% endcapture %}
{% assign latest_url = page.url | replace:VERSION_ROOT,latest_root %}
{% comment %}
If this page doesn't exist, just use root
{% endcomment %}
{% unless ALL_PAGES contains latest_url %}
{% assign latest_url = latest_root %}
{% endunless %}
<!-- Show warnings for special versions -->
<!-- master warning
{% if page.version == 'master' %}
<div class="alert docs-alert alert-info" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
{{ site.message.inmaster }}
<a href="{{ site.baseurl }}{{ latest_url }}">
{{ page.click_here_text }}
</a>
</div>
{% endif %}
-->
<!-- outdated warning
{% if page.version != 'master' and page.version != site.latest_docs_version %}
<div class="alert docs-alert alert-danger" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
{{ page.outdated_text }}
<a href="{{ site.baseurl }}{{ latest_url }}">
{{ page.click_here_text }}
</a>
</div>
{% endif %}
-->
<div id="page-toc-source">
{{ content }}
</div>
</div>
</div>
<div class="row">
{% include footer_docs.html %}
</div>
</div>
</div>
<script defer type="text/javascript" src="{{ site.baseurl }}/static/js/lib/toc.min.js"></script>
<script defer type="text/javascript" src="{{ site.baseurl }}/static/js/docs.js"></script>
|