summaryrefslogtreecommitdiffstats
path: root/src/arrow/docs/source/_templates
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/arrow/docs/source/_templates
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/arrow/docs/source/_templates')
-rw-r--r--src/arrow/docs/source/_templates/docs-sidebar.html25
-rw-r--r--src/arrow/docs/source/_templates/layout.html5
-rw-r--r--src/arrow/docs/source/_templates/version-switcher.html60
3 files changed, 90 insertions, 0 deletions
diff --git a/src/arrow/docs/source/_templates/docs-sidebar.html b/src/arrow/docs/source/_templates/docs-sidebar.html
new file mode 100644
index 000000000..fde4435df
--- /dev/null
+++ b/src/arrow/docs/source/_templates/docs-sidebar.html
@@ -0,0 +1,25 @@
+
+<a class="navbar-brand" href="{{ pathto(master_doc) }}">
+ <img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
+</a>
+
+<div id="version-search-wrapper">
+
+{% include "version-switcher.html" %}
+
+<form id="search-box" class="bd-search d-flex align-items-center" action="{{ pathto('search') }}" method="get">
+ <i class="icon fas fa-search"></i>
+ <input type="search" class="form-control" name="q" id="search-input" placeholder="{{ theme_search_bar_text }}" aria-label="{{ theme_search_bar_text }}" autocomplete="off" >
+</form>
+
+</div>
+
+<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
+ <div class="bd-toc-item active">
+ {% if "python/api" in pagename or "python/generated" in pagename %}
+ {{ generate_nav_html("sidebar", startdepth=0, maxdepth=3, collapse=False, includehidden=True, titles_only=True) }}
+ {% else %}
+ {{ generate_nav_html("sidebar", startdepth=0, maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
+ {% endif %}
+ </div>
+</nav>
diff --git a/src/arrow/docs/source/_templates/layout.html b/src/arrow/docs/source/_templates/layout.html
new file mode 100644
index 000000000..a9d0f30bc
--- /dev/null
+++ b/src/arrow/docs/source/_templates/layout.html
@@ -0,0 +1,5 @@
+{% extends "pydata_sphinx_theme/layout.html" %}
+
+{# Silence the navbar #}
+{% block docs_navbar %}
+{% endblock %}
diff --git a/src/arrow/docs/source/_templates/version-switcher.html b/src/arrow/docs/source/_templates/version-switcher.html
new file mode 100644
index 000000000..24a8c15ac
--- /dev/null
+++ b/src/arrow/docs/source/_templates/version-switcher.html
@@ -0,0 +1,60 @@
+<div id="version-button" class="dropdown">
+ <button type="button" class="btn btn-secondary btn-sm navbar-btn dropdown-toggle" id="version_switcher_button" data-toggle="dropdown">
+ {{ release }}
+ <span class="caret"></span>
+ </button>
+ <div id="version_switcher" class="dropdown-menu list-group-flush py-0" aria-labelledby="version_switcher_button">
+ <!-- dropdown will be populated by javascript on page load -->
+ </div>
+</div>
+
+<script type="text/javascript">
+// Function to construct the target URL from the JSON components
+function buildURL(entry) {
+ var template = "{{ switcher_template_url }}"; // supplied by jinja
+ template = template.replace("{version}", entry.version);
+ return template;
+}
+
+// Function to check if corresponding page path exists in other version of docs
+// and, if so, go there instead of the homepage of the other docs version
+function checkPageExistsAndRedirect(event) {
+ const currentFilePath = "{{ pagename }}.html",
+ otherDocsHomepage = event.target.getAttribute("href");
+ let tryUrl = `${otherDocsHomepage}${currentFilePath}`;
+ $.ajax({
+ type: 'HEAD',
+ url: tryUrl,
+ // if the page exists, go there
+ success: function() {
+ location.href = tryUrl;
+ }
+ }).fail(function() {
+ location.href = otherDocsHomepage;
+ });
+ return false;
+}
+
+// Function to populate the version switcher
+(function () {
+ // get JSON config
+ $.getJSON("{{ switcher_json_url }}", function(data, textStatus, jqXHR) {
+ // create the nodes first (before AJAX calls) to ensure the order is
+ // correct (for now, links will go to doc version homepage)
+ $.each(data, function(index, entry) {
+ // if no custom name specified (e.g., "latest"), use version string
+ if (!("name" in entry)) {
+ entry.name = entry.version;
+ }
+ // construct the appropriate URL, and add it to the dropdown
+ entry.url = buildURL(entry);
+ const node = document.createElement("a");
+ node.setAttribute("class", "list-group-item list-group-item-action py-1");
+ node.setAttribute("href", `${entry.url}`);
+ node.textContent = `${entry.name}`;
+ node.onclick = checkPageExistsAndRedirect;
+ $("#version_switcher").append(node);
+ });
+ });
+})();
+</script>