www/_layouts/docs.html (196 lines of code) (raw):

--- layout: base docs_tab: true analytics_id: UA-64283057-1 --- {% include header.html %} {% comment %} set some constants {% endcomment %} {% assign ALL_PAGES = site.data.all-pages %} {% assign TOCFILE = site.data.toc[page.tocfile] %} {% capture VERSION_ROOT %}/docs/{{ page.language }}/{{ page.version }}/{% endcapture %} {% capture LANGUAGE_ROOT %}/docs/{{ page.language }}/{% endcapture %} {% assign MY_ENTRY = page.url | replace: VERSION_ROOT,"" %} {% assign my_entry_parts = MY_ENTRY | split: "/" %} {% assign page_url = "/" | append: page.path | replace: ".md", ".html" %} {% comment %} PATH_TO_ROOT: path from here to version root, replacing all parts except the last one with '../' NOTE: the capture is a single line because extraneous whitespace would screw up the URI it produces {% endcomment %} {% capture PATH_TO_ROOT %}{{ VERSION_ROOT }}{% endcapture %} <div class="docs"> <!-- Table of Contents --> <div class="hidden-xs hidden-sm site-toc-container"> {% include toc_recursive_main.html entries=TOCFILE my_entry=MY_ENTRY path_to_root=PATH_TO_ROOT %} </div> <!-- Page content --> <div class="page-content-container"> <div class="page-content"> <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"> {{ layout.toc_text }} <span class="caret"></span> </button> <ul class="dropdown-menu"> {% include toc_recursive_dropdown.html entries=TOCFILE my_entry=MY_ENTRY path_to_root=PATH_TO_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 hidden-xs hidden-sm" 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 %}https://github.com/apache/cordova-docs/tree/master/www/{{ 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 %} <!-- 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 %} ({{ layout.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 %} ({{ layout.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.baseurl }}{{ 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> {{ layout.in_development_text }} <a href="{{ site.baseurl }}{{ latest_url }}"> {{ layout.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> {{ layout.outdated_text }} <a href="{{ site.baseurl }}{{ latest_url }}"> {{ layout.click_here_text }} </a> </div> {% endif %} <!-- plugin version warning --> {% if page.plugin_name and page.plugin_version %} <div class="alert alert-warning docs-alert" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> {{ page.plugin_version_text }} {{ page.plugin_version }}. <a href="https://github.com/apache/{{ page.plugin_name }}/releases"> {{ page.visit_github_text }} </a> </div> {% endif %} <div id="page-toc-source"> {{ content }} </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>