2021-03-02 15:59:38 +00:00
|
|
|
{% extends "basic/layout.html" %}
|
2020-10-02 20:59:41 +00:00
|
|
|
{# Remove broken "genindex" link - unfortunately this takes with it the acceptable "next" and "previous" links, but they're not super necessary. #}
|
|
|
|
{% set rellinks = [] %}
|
2020-10-02 17:23:08 +00:00
|
|
|
|
|
|
|
{% block rootrellink %}
|
|
|
|
<li><img src="{{ pathto('_static/' + theme_root_icon, 1) }}" alt=""
|
2021-06-03 17:02:53 +00:00
|
|
|
style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
|
2020-10-02 17:23:08 +00:00
|
|
|
<li><a href="{{theme_root_url}}">{{theme_root_name}}</a>{{ reldelim1 }}</li>
|
|
|
|
{% if theme_root_include_title %}
|
|
|
|
<a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{%- macro searchbox() %}
|
|
|
|
{# modified from sphinx/themes/basic/searchbox.html #}
|
|
|
|
{%- if builder != "htmlhelp" %}
|
2023-08-23 16:10:55 +00:00
|
|
|
<div class="inline-search" role="search">
|
2020-10-02 17:23:08 +00:00
|
|
|
<form class="inline-search" action="{{ pathto('search') }}" method="get">
|
|
|
|
<input placeholder="{{ _('Quick search') }}" type="text" name="q" />
|
|
|
|
<input type="submit" value="{{ _('Go') }}" />
|
|
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
|
|
<input type="hidden" name="area" value="default" />
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{%- endif %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
2020-10-03 17:44:12 +00:00
|
|
|
{% block header %}<div id="fmain">{% endblock %}
|
2020-10-02 17:23:08 +00:00
|
|
|
{% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
|
|
|
|
{% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
|
|
|
|
{% block relbaritems %}
|
|
|
|
{%- if pagename != "search" and builder != "singlehtml" and builder != "htmlhelp" %}
|
|
|
|
<li class="right">
|
|
|
|
{{ searchbox() }}
|
|
|
|
</li>
|
|
|
|
{%- endif %}
|
2022-06-20 21:40:13 +00:00
|
|
|
{# This is hidden by default, unhidden by our global shared script. #}
|
|
|
|
<div id="old-docs-notice" style="display: none">
|
|
|
|
This documents an old version of fish.
|
|
|
|
<a href="{{ pathto('../current/', 1) }}">See the latest release.</a>
|
|
|
|
</div>
|
2020-10-02 17:23:08 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2021-05-27 20:02:48 +00:00
|
|
|
{# The sidebar goes into the *document* block, so it ends up in the document *div* so it doesn't go over the footer #}
|
|
|
|
{% block document %}{{ sidebar() }}{{ super() }}{% endblock %}
|
2021-01-27 20:53:24 +00:00
|
|
|
{% block sidebar2 %} {% endblock %}
|
2020-10-02 17:23:08 +00:00
|
|
|
{% block extrahead %}
|
|
|
|
<link rel="shortcut icon" type="image/png" href="{{ pathto('_static/' + theme_root_icon, 1) }}" />
|
|
|
|
{{ super() }}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block footer %}
|
|
|
|
<div class="footer">
|
2020-10-02 21:02:05 +00:00
|
|
|
© {% trans %}Copyright{% endtrans %} {{ copyright|e }}.
|
2020-10-02 17:23:08 +00:00
|
|
|
<br />
|
|
|
|
{%- if last_updated %}
|
|
|
|
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
|
|
|
|
{%- endif %}
|
|
|
|
{% if theme_issues_url %}{% trans pathto_bugs=theme_issues_url %}<a href="{{ theme_issues_url }}">Found a bug</a>?{% endtrans %}{% endif %}
|
|
|
|
<br />
|
|
|
|
|
|
|
|
{% trans sphinx_version=sphinx_version|e %}Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
|
|
|
|
</div>
|
2020-10-03 17:44:12 +00:00
|
|
|
</div>
|
docs: Add copy buttons to all the codeblocks
This uses a bit of javascript to add copy buttons, so you can directly
copy all the code in a given block to the clipboard!
For codeblocks without prompts, it just copies all the code, for
blocks with prompts, it copies all the lines after prompts, under the
assumption that that's the code to be executed.
It would give you *all* the lines, so the output wouldn't be
interleaved like it is in the html, but good enough.
The buttons appear on hover, so they aren't usable on phones, but
since you won't really have a clipboard on phones and I have no idea
how to make them not always in front of the text otherwise: Eh.
I'm not in love with the javascript here, but it'll do.
2021-08-13 16:50:38 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2022-06-20 21:40:13 +00:00
|
|
|
FISH_DOCS_VERSION = "{{ version }}";
|
|
|
|
|
docs: Add copy buttons to all the codeblocks
This uses a bit of javascript to add copy buttons, so you can directly
copy all the code in a given block to the clipboard!
For codeblocks without prompts, it just copies all the code, for
blocks with prompts, it copies all the lines after prompts, under the
assumption that that's the code to be executed.
It would give you *all* the lines, so the output wouldn't be
interleaved like it is in the html, but good enough.
The buttons appear on hover, so they aren't usable on phones, but
since you won't really have a clipboard on phones and I have no idea
how to make them not always in front of the text otherwise: Eh.
I'm not in love with the javascript here, but it'll do.
2021-08-13 16:50:38 +00:00
|
|
|
function copy_to_clipboard(it) {
|
|
|
|
// Find the pre tag we're interested in.
|
|
|
|
var pre = it.target;
|
|
|
|
while (pre.tagName != "PRE") pre = pre.parentNode;
|
|
|
|
var txt = "";
|
|
|
|
// Cheesy: If we have a prompt,
|
|
|
|
// we only copy prompted lines,
|
|
|
|
// by splitting and matching and stuff
|
|
|
|
if (pre.querySelector('span.gp')) {
|
|
|
|
var texts= [];
|
|
|
|
for (var line of pre.innerText.split('\n')) {
|
|
|
|
if (line.match(/^>_?.*/)) {
|
|
|
|
texts.push(line.replace(/^>_?/, ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
txt = texts.join("\n");
|
|
|
|
} else {
|
|
|
|
// Even cheesier: If we don't have a prompt, we remove the button text from the end.
|
|
|
|
var txt = pre.innerText.substring(0, pre.innerText.length - it.target.innerText.length).trim();
|
|
|
|
}
|
|
|
|
|
|
|
|
navigator.clipboard.writeText(txt).then(function() {
|
|
|
|
// Success - set the text to indicate it,
|
|
|
|
// then set it back after 2 seconds.
|
|
|
|
var span = pre.querySelector("button span");
|
|
|
|
if (span) {
|
|
|
|
var oldText = span.innerText;
|
|
|
|
span.innerText = "COPIED!";
|
|
|
|
setTimeout(function() {
|
|
|
|
span.innerText = oldText;
|
|
|
|
}, 2000);
|
|
|
|
}
|
|
|
|
}, function() {
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
// Add copy buttons to all the codeblocks.
|
|
|
|
var codeblocks = document.querySelectorAll('div > pre');
|
|
|
|
|
|
|
|
var button = document.createElement('button');
|
|
|
|
var span = document.createElement('span');
|
|
|
|
span.innerText = "COPY";
|
|
|
|
button.appendChild(span);
|
|
|
|
|
|
|
|
for (var i of codeblocks) {
|
|
|
|
var newButton = button.cloneNode(true);
|
|
|
|
newButton.addEventListener('click', copy_to_clipboard);
|
|
|
|
i.appendChild(newButton);
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
2020-10-02 17:23:08 +00:00
|
|
|
{% endblock %}
|