aboutsummaryrefslogtreecommitdiffstats
path: root/site/_layouts/doc.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/_layouts/doc.html')
-rw-r--r--site/_layouts/doc.html271
1 files changed, 271 insertions, 0 deletions
diff --git a/site/_layouts/doc.html b/site/_layouts/doc.html
new file mode 100644
index 0000000..ed39f8c
--- /dev/null
+++ b/site/_layouts/doc.html
@@ -0,0 +1,271 @@
+---
+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 /dev/ or /latest/:
+ show edit link for /dev/ page in source language
+ if page not in source language:
+ show translation link for /dev/ 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 dev_version %}/dev/{% endcapture %}
+ {% capture src_language %}/{{ site.src_language }}/{% endcapture %}
+
+ {% comment %}
+ Edit-links for current pages in non-source languages
+ NOTE:
+ Pages that are under /dev/ 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/dev" | 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,dev_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 dev instead
+ {% endcomment %}
+ {% if page.version == site.latest_docs_version %}
+ {% assign edit_link = base_edit_link | replace:base_version,dev_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 -->
+ <!-- dev warning -->
+ {% if page.version == 'dev' %}
+ <div class="alert docs-alert alert-info" role="alert">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ {{ site.message.indev }}
+ <a href="{{ site.baseurl }}{{ latest_url }}">
+ {{ page.click_here_text }}
+ </a>
+ </div>
+ {% endif %}
+
+ <!-- outdated warning -->
+ {% if page.version != 'dev' 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">&times;</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>