Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add djlint for automatic template formatting + fixing #3215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ repos:
images/minesweeper/requirements.txt|
images/federation-redirect/requirements.txt

# Autoformat jinja2 templates
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.36.4
hooks:
- id: djlint-reformat-jinja
- id: djlint-jinja

# Lint: Python code
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
Expand Down
16 changes: 9 additions & 7 deletions docs/source/_templates/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
be overridden so this custom theme handles title and
toctree for sidebar
#}
<h3>{{ _('Table of Contents') }}</h3>
<h3>{{ _("Table of Contents") }}</h3>
{{ toctree(includehidden=theme_sidebar_includehidden, collapse=theme_sidebar_collapse) }}
{% if theme_extra_nav_links %}
<hr />
<ul>
{% for text, uri in theme_extra_nav_links.items() %}
<li class="toctree-l1"><a href="{{ uri }}">{{ text }}</a></li>
{% endfor %}
</ul>
<hr />
<ul>
{% for text, uri in theme_extra_nav_links.items() %}
<li class="toctree-l1">
<a href="{{ uri }}">{{ text }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
29 changes: 18 additions & 11 deletions docs/source/_templates/relations.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
alabaster theme does not provide previous/next page by default
#}
<div class="relations">
<h3>Navigation</h3>
<ul>
<li><a href="{{ pathto(master_doc) }}">Documentation Home</a><ul>
{%- if prev %}
<li><a href="{{ prev.link|e }}" title="Previous">Previous topic</a></li>
{%- endif %}
{%- if next %}
<li><a href="{{ next.link|e }}" title="Next">Next topic</a></li>
{%- endif %}
</ul>
</ul>
<h3>Navigation</h3>
<ul>
<li>
<a href="{{ pathto(master_doc) }}">Documentation Home</a>
<ul>
{%- if prev %}
<li>
<a href="{{ prev.link|e }}" title="Previous">Previous topic</a>
</li>
{%- endif %}
{%- if next %}
<li>
<a href="{{ next.link|e }}" title="Next">Next topic</a>
</li>
{%- endif %}
</ul>
</li>
</ul>
</div>
109 changes: 53 additions & 56 deletions images/analytics-publisher/index.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="static/bootstrap-4.1.3.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO">
<style>
</style>
<title>MyBinder.org Events Archive</title>
</head>

<body>
<div class='container' id='main-container'>
<div class='jumbotron'>
<h1 class='display-3'>MyBinder.org Events Archive</h1>
<p class='lead'>
Daily archive of analytics events emitted by MyBinder.org.
<a href="https://mybinder-sre.readthedocs.io/en/latest/analytics/events-archive.html">Documentation</a>
</p>
<p>
<a href='index.jsonl'>Machine readable index</a> also available.
Ask questions about this dataset or show off cool stuff built with it at the
the <a href="https://discourse.jupyter.org/">Jupyter Discourse Forum</a>.
</p>
<p class='font-weight-light'>
Released under the <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0 license</a>.
</p>
</div>
<table class='table'>
<thead>
<th>Date</th>
<th>Filename</th>
<th>Number of Events</th>
</thead>
{% for archive in archives %}
<tr>
<td>{{ archive.date }}</td>
<td><a href="{{ archive.name }}">{{ archive.name }}</a></td>
<td>{{ archive.count }}</td>
</tr>
{% endfor %}
</table>

<br />
<div id='footer' class='border-top row'>
<div class='col-sm font-weight-light text-right pb-2 pt-2'>
Generated by love with
<a href='https://github.com/jupyterhub/mybinder.org-deploy/tree/HEAD/images/analytics-publisher'>
these scripts
</a> at {{ generated_time }}
</p>
</div>
</body>

</html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet"
href="static/bootstrap-4.1.3.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO">
<style></style>
<title>MyBinder.org Events Archive</title>
</head>
<body>
<div class='container' id='main-container'>
<div class='jumbotron'>
<h1 class='display-3'>MyBinder.org Events Archive</h1>
<p class='lead'>
Daily archive of analytics events emitted by MyBinder.org.
<a href="https://mybinder-sre.readthedocs.io/en/latest/analytics/events-archive.html">Documentation</a>
</p>
<p>
<a href='index.jsonl'>Machine readable index</a> also available.
Ask questions about this dataset or show off cool stuff built with it at the
the <a href="https://discourse.jupyter.org/">Jupyter Discourse Forum</a>.
</p>
<p class='font-weight-light'>
Released under the <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0 license</a>.
</p>
</div>
<table class='table'>
<thead>
<th>Date</th>
<th>Filename</th>
<th>Number of Events</th>
</thead>
{% for archive in archives %}
<tr>
<td>{{ archive.date }}</td>
<td>
<a href="{{ archive.name }}">{{ archive.name }}</a>
</td>
<td>{{ archive.count }}</td>
</tr>
{% endfor %}
</table>
<br />
<div id='footer' class='border-top row'>
<div class='col-sm font-weight-light text-right pb-2 pt-2'>
Generated by love with
<a href='https://github.com/jupyterhub/mybinder.org-deploy/tree/HEAD/images/analytics-publisher'>these scripts</a> at {{ generated_time }}
</p>
</div>
</body>
</html>
51 changes: 24 additions & 27 deletions mybinder/files/etc/jupyter/templates/login.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
{% extends "templates/login.html" %}

{% block header_buttons %}
{% block login_widget %}
{% endblock %}
<span class="flex-spacer"></span>
{{super()}}
{% block login_widget %}
{% endblock login_widget %}
<span class="flex-spacer"></span>
{{ super() }}
{% endblock header_buttons %}

{% block site %}
<div id="ipython-main-app" class="container">
<h1>Binder inaccessible</h1>
<h2>
You can get a new Binder for this repo by clicking <a href="{{binder_url}}">here</a>.
</h2>
<p>
The shareable URL for this repo is: <tt>{{binder_url}}</tt>
</p>

<h4>Is this a Binder that you created?</h4>
<p>
If so, your authentication cookie for this Binder has been deleted or expired.
You can launch a new Binder for this repo by clicking <a href="{{binder_url}}">here</a>.
</p>

<h4>Did someone give you this Binder link?</h4>
<p>
If so, the link is outdated or incorrect.
Recheck the link for typos or ask the person who gave you the link for an updated link.
A shareable Binder link should look like <tt>{{binder_url}}</tt>.
</div>
<div id="ipython-main-app" class="container">
<h1>Binder inaccessible</h1>
<h2>
You can get a new Binder for this repo by clicking <a href="{{ binder_url }}">here</a>.
</h2>
<p>
The shareable URL for this repo is: <tt>{{ binder_url }}</tt>
</p>
<h4>Is this a Binder that you created?</h4>
<p>
If so, your authentication cookie for this Binder has been deleted or expired.
You can launch a new Binder for this repo by clicking <a href="{{ binder_url }}">here</a>.
</p>
<h4>Did someone give you this Binder link?</h4>
<p>
If so, the link is outdated or incorrect.
Recheck the link for typos or ask the person who gave you the link for an updated link.
A shareable Binder link should look like <tt>{{ binder_url }}</tt>.
</p>
</div>
{% endblock site %}
70 changes: 36 additions & 34 deletions mybinder/files/etc/jupyter/templates/page.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
{% extends "templates/page.html" %}

{% block header_buttons %}

{% block login_widget %}
{% endblock %}

{% if jitsi_url %}
<span>
<a id="visit-repo-link" href="{{ jitsi_url }}" class="btn btn-default btn-sm navbar-btn" target="_blank"
style="margin-right: 2px; margin-left: 4px;">Join this repo's Video Chat</a>
</span>
{% endif %}

{% if ref_url %}
<span>
<a id="visit-repo-link" href="{{ ref_url }}" class="btn btn-default btn-sm navbar-btn" target="_blank"
style="margin-right: 2px; margin-left: 4px;">Visit repo</a>
</span>
{% endif %}

{% if persistent_binder_url %}
<span>
<button id="copy-binder-link" title="Copy binder link to clipboard" class="btn btn-default btn-sm navbar-btn"
style="margin-right: 0; margin-left: 2px;"
data-url="{{ persistent_binder_url }}" onclick="copy_link_into_clipboard(this);">
Copy Binder link
</button>
</span>
{% endif %}

{% block login_widget %}{% endblock %}
{% if jitsi_url %}
<span>
<a id="visit-repo-link"
href="{{ jitsi_url }}"
class="btn btn-default btn-sm navbar-btn"
target="_blank"
style="margin-right: 2px;
margin-left: 4px">Join this repo's Video Chat</a>
</span>
{% endif %}
{% if ref_url %}
<span>
<a id="visit-repo-link"
href="{{ ref_url }}"
class="btn btn-default btn-sm navbar-btn"
target="_blank"
style="margin-right: 2px;
margin-left: 4px">Visit repo</a>
</span>
{% endif %}
{% if persistent_binder_url %}
<span>
<button id="copy-binder-link"
title="Copy binder link to clipboard"
class="btn btn-default btn-sm navbar-btn"
style="margin-right: 0;
margin-left: 2px"
data-url="{{ persistent_binder_url }}"
onclick="copy_link_into_clipboard(this);">Copy Binder link</button>
</span>
{% endif %}
{% endblock header_buttons %}

{% block script %}
{% if persistent_binder_url %}
<script type='text/javascript'>
{% if persistent_binder_url %}
<script type='text/javascript'>
function copy_link_into_clipboard(b) {
var $temp = $("<input>");
$(b).parent().append($temp);
$temp.val($(b).data('url')).select();
document.execCommand("copy");
$temp.remove();
}
</script>
{% endif %}
</script>
{% endif %}
{% endblock %}
23 changes: 10 additions & 13 deletions mybinder/files/etc/jupyter/templates/tree.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{% extends "templates/tree.html" %}

{% block headercontainer %}
<span class="flex-spacer"></span>
{% endblock %}

<span class="flex-spacer"></span>
{% endblock headercontainer %}
{% block header_buttons %}
{{super()}}
{% if shutdown_button %}
<span id="shutdown_widget">
<button id="shutdown" class="btn btn-sm navbar-btn"
title="{% trans %}Stop the Jupyter server{% endtrans %}">
{% trans %}Quit{% endtrans %}
</button>
</span>
{% endif %}
{{ super() }}
{% if shutdown_button %}
<span id="shutdown_widget">
<button id="shutdown"
class="btn btn-sm navbar-btn"
title="{% trans %}Stop the Jupyter server{% endtrans %}">{% trans %}Quit{% endtrans %}</button>
</span>
{% endif %}
{% endblock header_buttons %}
Loading