Skip to content

Commit 728b78b

Browse files
authored
Merge pull request #297 from minrk/rtd
migrate docs to RTD
2 parents 48f5fdb + 55da294 commit 728b78b

File tree

8 files changed

+62
-68
lines changed

8 files changed

+62
-68
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,3 @@ jobs:
3939
run: |
4040
cd docs
4141
make linkcheck
42-
43-
build-and-publish:
44-
runs-on: ubuntu-22.04
45-
46-
permissions:
47-
# required to push to the gh-pages branch
48-
contents: write
49-
50-
steps:
51-
- uses: actions/checkout@v3
52-
- uses: actions/setup-python@v4
53-
with:
54-
python-version: "3.11"
55-
56-
- name: Install dependencies
57-
run: |
58-
pip install -r docs/doc-requirements.txt
59-
60-
- name: make html (Builds documentation)
61-
run: |
62-
cd docs
63-
make html
64-
65-
- name: Publish to GitHub Pages
66-
if: github.ref == 'refs/heads/main'
67-
run: |
68-
pip install ghp-import
69-
ghp-import --no-jekyll --push --message "Update documentation [skip ci]" docs/_build/html

.readthedocs.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Configuration on how ReadTheDocs (RTD) builds our documentation
2+
# ref: https://readthedocs.org/projects/nbgitpuller/
3+
# ref: https://docs.readthedocs.io/en/stable/config-file/v2.html
4+
#
5+
version: 2
6+
7+
sphinx:
8+
configuration: docs/conf.py
9+
10+
build:
11+
os: ubuntu-20.04
12+
tools:
13+
python: "3.10"
14+
15+
python:
16+
install:
17+
- requirements: docs/doc-requirements.txt

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# [nbgitpuller](https://github.com/jupyterhub/nbgitpuller)
22

33
[![GitHub Workflow Status - Test](https://img.shields.io/github/workflow/status/jupyterhub/nbgitpuller/Tests?logo=github&label=tests)](https://github.com/jupyterhub/nbgitpuller/actions)
4-
[![CircleCI build status](https://img.shields.io/circleci/build/github/jupyterhub/nbgitpuller?logo=circleci&label=docs)](https://circleci.com/gh/jupyterhub/nbgitpuller)
4+
[![Documentation Status](https://readthedocs.org/projects/nbgitpuller/badge/?version=latest)](https://nbgitpuller.readthedocs.io/en/latest/?badge=latest)
55
[![](https://img.shields.io/pypi/v/nbgitpuller.svg?logo=pypi)](https://pypi.python.org/pypi/nbgitpuller)
66
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyterhub/nbgitpuller/issues)
77
[![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub)
88
[![Gitter](https://img.shields.io/badge/social_chat-gitter-blue?logo=gitter)](https://gitter.im/jupyterhub/jupyterhub)
99

1010
`nbgitpuller` lets you distribute content in a git repository to your students
1111
by having them click a simple link. [Automatic
12-
merging](https://jupyterhub.github.io/nbgitpuller/topic/automatic-merging.html)
12+
merging](https://nbgitpuller.readthedocs.io/topic/automatic-merging.html)
1313
ensures that your students are never exposed to `git` directly. It is primarily
1414
used with a JupyterHub, but can also work on students' local computers.
1515

16-
See [the documentation](https://jupyterhub.github.io/nbgitpuller) for more
16+
See [the documentation](https://nbgitpuller.readthedocs.io) for more
1717
information.
1818

1919
## Installation
@@ -24,10 +24,12 @@ pip install nbgitpuller
2424

2525
## Example
2626

27-
This example shows how to use the [nbgitpuller link generator](https://jupyterhub.github.io/nbgitpuller/link)
27+
This example shows how to use the [nbgitpuller link generator]
2828
to create an nbgitpuller link, which a user then clicks.
2929

30-
1. The [nbgitpuller link generator GUI](https://jupyterhub.github.io/nbgitpuller/link) is used to create a
30+
[nbgitpuller link generator]: https://nbgitpuller.readthedocs.io/link
31+
32+
1. The nbgitpuller link generator GUI is used to create a
3133
link.
3234

3335
![](https://raw.githubusercontent.com/jupyterhub/nbgitpuller/9f380a933335f0f069b6e2f9965ed78c3abcce7a/docs/_static/nbgitpuller-link-generator.png)

docs/_static/link_gen/link.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function displayLink() {
185185
hubUrl, urlPath, repoUrl, branch
186186
);
187187
} else if (activeTab === "tab-auth-binder"){
188-
// FIXME: userName parsing using new URL(...) assumes a
188+
// FIXME: userName parsing using new URL(...) assumes a
189189
// HTTP based repoUrl. Does it make sense to create a
190190
// BinderHub link for SSH URLs? Then let's fix this parsing.
191191
var userName = new URL(repoUrl).pathname.split('/')[1];
@@ -248,7 +248,7 @@ function render() {
248248
/**
249249
* Entry point
250250
*/
251-
function main() {
251+
function linkMain() {
252252
// Hook up any changes in form elements to call render()
253253
document.querySelectorAll('#linkgenerator input[type="radio"]').forEach(
254254
function (element) {
@@ -265,16 +265,15 @@ function main() {
265265

266266
// Activate tabs based on search parameters
267267
var params = new URL(window.location).searchParams;
268-
if (params.get("tab")) {
269-
if (params.get("tab") === "binder") {
270-
$("#tab-auth-binder").click()
271-
} else if (params.get("tab") === "canvas") {
272-
$("#tab-auth-canvas").click()
273-
}
268+
switch(params.get("tab")) {
269+
case "binder":
270+
$("#tab-auth-binder").click();
271+
break;
272+
case "canvas":
273+
$("#tab-auth-canvas").click();
274+
break;
274275
}
275276

276277
// Do an initial render, to make sure our disabled / enabled properties are correctly set
277278
render();
278279
}
279-
280-
window.onload = main;

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def setup(app):
5353
#
5454
# This is also used if you do content translation via gettext catalogs.
5555
# Usually you set "language" from the command line for these cases.
56-
language = None
56+
language = "en"
5757

5858
# List of patterns, relative to source directory, that match files and
5959
# directories to ignore when looking for source files.

docs/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ It is commonly used to distribute content to multiple users of a JupyterHub, tho
1010

1111
Here's an example of `nbgitpuller` in action:
1212

13-
1. The [nbgitpuller link
14-
generator](https://jupyterhub.github.io/nbgitpuller/link) is used to create a
15-
link.
13+
1. The [nbgitpuller link generator](link) is used to create a link.
1614

1715
```{image} _static/nbgitpuller-link-generator.png
1816

docs/link.rst

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,42 @@ Use the following form to create your own ``nbgitpuller`` links.
1212

1313
.. raw:: html
1414

15-
<div class="container full-width">
15+
<div class="container">
1616
<form id="linkgenerator" class="form needs-validation">
1717

1818
<div class="form-group">
1919

2020
<ul class="nav nav-tabs justify-content-end" role="tablist">
21-
<li class="nav-item">
22-
<a class="nav-link active" id="tab-auth-default" data-toggle="tab" role="tab" href="#auth-default" aria-controls="auth-default" onclick="changeTab(this)">
21+
<li class="nav-item" role="presentation">
22+
<button class="nav-link active" id="tab-auth-default" data-bs-toggle="tab" data-bs-target="#auth-default" type="button" role="tab" aria-controls="auth-default" aria-selected="true" onclick="changeTab(this)">
2323
<small>JupyterHub</small>
24-
</a>
24+
</button>
2525
</li>
26-
<li class="nav-item">
27-
<a class="nav-link" id="tab-auth-canvas" data-toggle="tab" role="tab" href="#auth-canvas" aria-controls="auth-canvas" onclick="changeTab(this)">
26+
<li class="nav-item" role="presentation">
27+
<button class="nav-link" id="tab-auth-canvas" data-bs-target="#auth-canvas" data-bs-toggle="tab" type="button" role="tab" aria-controls="auth-canvas"
28+
aria-selected="false" onclick="changeTab(this)">
2829
<small>Launch from Canvas</small>
29-
</a>
30+
</button>
3031
</li>
31-
<li class="nav-item">
32-
<a class="nav-link" id="tab-auth-binder" data-toggle="tab" role="tab" href="#auth-binder" aria-controls="auth-binder" onclick="changeTab(this)">
32+
<li class="nav-item" role="presentation">
33+
<button class="nav-link" id="tab-auth-binder" data-bs-toggle="tab" data-bs-target="#auth-binder" type="button" role="tab" aria-controls="auth-binder"
34+
aria-selected="false" onclick="changeTab(this)">
3335
<small>Binder</small>
34-
</a>
36+
</button>
3537
</li>
3638
</ul>
3739

3840
<div class="tab-content">
39-
<div class="tab-pane fade show active" id="auth-default" role="tabpanel" aria-labelledby="tab-auth-default">
41+
<div class="tab-pane fade show active" id="auth-default" role="tabpanel" aria-labelledby="tab-auth-default" tabindex="0">
4042
<input type="text" readonly class="form-control form-control" id="default-link" name="auth-default-link" placeholder="Generated link appears here...">
4143
</div>
42-
<div class="tab-pane fade" id="auth-canvas" role="tabpanel" aria-labelledby="tab-auth-canvas">
44+
<div class="tab-pane fade" id="auth-canvas" role="tabpanel" aria-labelledby="tab-auth-canvas" tabindex="0">
4345
<input type="text" readonly class="form-control form-control" id="canvas-link" name="auth-canvas-link" placeholder="Generated canvas 'external app' link appears here...">
4446
</div>
45-
<div class="tab-pane fade" id="auth-binder" role="tabpanel" aria-labelledby="tab-auth-binder">
47+
<div class="tab-pane fade" id="auth-binder" role="tabpanel" aria-labelledby="tab-auth-binder" tabindex="0">
4648
<input type="text" readonly class="form-control form-control" id="binder-link" name="auth-binder-link" placeholder="Generated Binder link appears here...">
4749
</div>
4850
</div>
49-
</ul>
5051
</div>
5152

5253
<div class="form-group row">
@@ -175,6 +176,11 @@ Use the following form to create your own ``nbgitpuller`` links.
175176
</div>
176177
<br /><br /><br />
177178

179+
<script type="text/javascript">
180+
// load link javascript on page load
181+
window.addEventListener("load", linkMain);
182+
</script>
183+
178184

179185
**Pre-populating some fields in the link generator**
180186

@@ -183,19 +189,19 @@ users to create their own links. To do so, use the following URL
183189
parameters **when accessing this page**:
184190

185191
* ``hub`` is the URL of a JupyterHub
186-
* ``repo`` is the URL of a github repository to which you're linking
192+
* ``repo`` is the URL of a GitHub repository to which you're linking
187193
* ``branch`` is the branch you wish to pull from the Repository
188194

189195
For example, the following URL will pre-populate the form with the
190196
UC Berkeley DataHub as the JupyterHub::
191197

192-
https://jupyterhub.github.io/nbgitpuller/link?hub=https://datahub.berkeley.edu
198+
https://nbgitpuller.readthedocs.io/link.html?hub=https://datahub.berkeley.edu
193199

194200

195201
**Activating a tab when someone lands on this page**
196202

197203
You can also activate one of the tabs in the form above by default when a user lands
198-
on this page. To do so, use the ``tab=`` REST parameter. Here are the possible values:
204+
on this page. To do so, use the ``tab=`` query parameter. Here are the possible values:
199205

200206
* ``?tab=binder`` - activates the Binder tab
201-
* ``?tab=canvas`` - activates the Canvas tab.
207+
* ``?tab=canvas`` - activates the Canvas tab

docs/topic/url-options.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Options in an nbgitpuller URL
77
.. note::
88

99
If you just want to generate an nbgitpuller link, we highly
10-
recommend just using the `link generator <https://jupyterhub.github.io/nbgitpuller/link>`_
10+
recommend just using the :doc:`link generator <../link>`
1111

1212
Most aspects of the nbgitpuller student experience can be configured
1313
with various options in the nbgitpuller URL. This page documents
@@ -41,12 +41,12 @@ the file to be opened in.
4141
the local repository directory too, otherwise nbgitpuller can not
4242
find the file.
4343

44-
For example, if the repository you are cloning is
44+
For example, if the repository you are cloning is
4545
``https://github.com/my-user/my-repository``, and the file you want
4646
your students to see is ``index.ipynb``, then ``<full-path-to-file>``
4747
should be ``my-repository/index.ipynb``, **not** ``index.ipynb``.
4848

49-
The `link generator <https://jupyterhub.github.io/nbgitpuller/link>`_
49+
The :doc:`link generator <../link>`
5050
takes care of all of this for you, so it is recommended to use that.
5151

5252

0 commit comments

Comments
 (0)