blob: cf0f54f2d40c3cb26a4d670a6f27207caf5b07b7 [file] [log] [blame]
---
nav: docs
---
<!-- /versions/main/foo/bar -> ["main", "foo", "bar"] -->
<!-- /versions/0.12.3/baz.md -> ["0.12.3", "baz.md"] -->
{% assign versioned_url_parts = page.url | split: '/' | shift | shift %}
{% assign current_version = versioned_url_parts.first %}
{% assign version_components = current_version | split: '.' %}
{% if version_components.size < 2 %}
{% assign major_version = "master" %}
{% assign minor_version = "master" %}
{% else %}
{% assign major_version = version_components[0] | plus:0 %}
{% assign minor_version = version_components[1] | plus:0 %}
{% endif %}
<!DOCTYPE html>
<html lang="en" itemscope itemtype="https://schema.org/WebPage">
{% include head.html current_version=current_version %}
<body>
{% include header.html current_version=current_version %}
<div class="container vpad">
<div class="row">
<div class="col-md-2">
<a class="btn btn-default btn-lg btn-block sidebar-toggle"
data-toggle="collapse" href="#sidebar-nav" aria-expanded="false"
aria-controls="sidebar-nav">
<i class="glyphicon glyphicon-menu-hamburger"></i> Navigation
</a>
<nav class="sidebar collapse" id="sidebar-nav">
<select onchange="location.href=this.value">
<option value="" selected disabled hidden>Version: {{ current_version }}</option>
{% for doc_version in site.doc_versions %}
<!-- reconstruct absolute url for the current page for each doc version -->
<option value="/{{ versioned_url_parts | shift | unshift: doc_version | unshift: 'versions' | join: '/' }}">
{{ doc_version }}
</option>
{% endfor %}
</select>
<!-- If the current version has a explicitly versioned sidebar for the major version -->
{% if site.doc_versions contains current_version %}
{% capture sidebar %}{{page.category}}-sidebar/{{major_version}}/sidebar.html{% endcapture %}
{% else %}
<!-- else, use the latest sidebar -->
{% capture sidebar %}{{page.category}}-sidebar/master/sidebar.html{% endcapture %}
{% endif %}
{% include {{ sidebar }} current_version=current_version %}
</nav>
</div>
<div class="col-md-8">
<div class="content">
{{ content }}
</div>
</div>
<div class="col-md-2 sticky-sidebar">
<div class="right-sidebar">
<ul class="gh-links">
<li><a href="https://github.com/bazelbuild/bazel/issues/new?title=Documentation issue: {{ page.title }}&body=Documentation URL: https://docs.bazel.build{{ page.url }}&labels=type: documentation"><i class="fa fa-github"></i> Create issue</a></li>
<li id="gh-edit-list-item" class="default-hidden" aria-hidden="true"><a id="gh-edit" class="gh-edit default-hidden"><i class="fa fa-pencil" aria-hidden="true"></i> Edit this page</a></li>
</ul>
<script>
var versionDocsURLRegex = /\/versions\/[\w\.]+\/(.*)/;
var ghDocsBazeURL = 'https://github.com/bazelbuild/bazel/tree/master/site/docs/';
var editButton = document.getElementById('gh-edit');
var editButtonListItem = document.getElementById('gh-edit-list-item');
// if there is an edit button and we are not in the Build Encyclopedia
// or other generated files.
if (editButton
&& window.location.pathname.match(versionDocsURLRegex)
&& window.location.pathname.lastIndexOf('/be/') == -1
&& window.location.pathname.lastIndexOf('/repo/') == -1
&& window.location.pathname.lastIndexOf('/skylark/lib/') == -1
&& window.location.pathname.lastIndexOf('/command-line-reference.html') == -1) {
var docFile = window.location.pathname.match(versionDocsURLRegex)[1];
// some pages are not using markdown :(
if (docFile !== 'user-manual.html'
&& docFile !== 'build-ref.html'
&& docFile !== 'query.html'
&& docFile !== 'test-encyclopedia.html') {
docFile = docFile.replace('html', 'md');
}
editButton.href = ghDocsBazeURL + docFile;
editButton.style.visibility = 'visible';
editButtonListItem.style.visibility = 'visible';
}
</script>
{{ content | toc_only }}
</div>
</div>
</div>
</div>
<!-- Satisfaction Survey -->
<script async="" defer="" src="//www.google.com/insights/consumersurveys/async_survey?site=WiW2jfuqA0qnVVi98UP0WeVsqBPB"></script>
{% include footer.html %}
</body>
</html>