mirror of
https://github.com/borgbackup/borg.git
synced 2026-07-14 20:41:04 -04:00
Merge pull request #9737 from ThomasWaldmann/pdf-docs3-1.4
docs: render downloads as a single inline line below the search box
This commit is contained in:
commit
1fb3a0ab4d
1 changed files with 10 additions and 14 deletions
24
docs/_templates/downloads.html
vendored
24
docs/_templates/downloads.html
vendored
|
|
@ -1,28 +1,24 @@
|
|||
<div class="borg-downloads" id="borg-downloads" style="display:none;">
|
||||
<p class="caption"><span class="caption-text">Download docs</span></p>
|
||||
<ul id="borg-downloads-list"></ul>
|
||||
</div>
|
||||
<p class="borg-downloads" id="borg-downloads" style="display:none;">Downloads: <span id="borg-downloads-list"></span></p>
|
||||
<script type="text/javascript">
|
||||
// Populate offline download links (PDF, HTMLzip, ...) using ReadTheDocs data if available.
|
||||
// Populate offline download links (PDF, HTMLzip, ...) on a single line using ReadTheDocs data if available.
|
||||
function borgInitDownloads(data) {
|
||||
var downloads = data && data.versions && data.versions.current && data.versions.current.downloads;
|
||||
if (!downloads) return;
|
||||
var labels = {pdf: "PDF", htmlzip: "HTML (zip)", epub: "ePub"};
|
||||
var list = document.getElementById("borg-downloads-list");
|
||||
if (!list) return;
|
||||
var count = 0;
|
||||
var labels = {pdf: "PDF", htmlzip: "HTML", epub: "ePub"};
|
||||
var span = document.getElementById("borg-downloads-list");
|
||||
if (!span) return;
|
||||
var first = true;
|
||||
Object.keys(downloads).forEach(function(fmt) {
|
||||
var url = downloads[fmt];
|
||||
if (!url) return;
|
||||
var li = document.createElement("li");
|
||||
if (!first) span.appendChild(document.createTextNode(" | "));
|
||||
var a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.textContent = labels[fmt] || fmt;
|
||||
li.appendChild(a);
|
||||
list.appendChild(li);
|
||||
count++;
|
||||
span.appendChild(a);
|
||||
first = false;
|
||||
});
|
||||
if (count) document.getElementById("borg-downloads").style.display = "";
|
||||
if (!first) document.getElementById("borg-downloads").style.display = "";
|
||||
}
|
||||
|
||||
document.addEventListener("readthedocs-addons-data-ready", function(event) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue