Skip to content

Commit

Permalink
Update to use napari-sphinx-theme 0.3.0 (#267)
Browse files Browse the repository at this point in the history
Prepares the docs repo to use the new napari-sphinx-theme, 0.3.0, which depends on pydata-sphinx-theme rather than forking it.

# References and relevant issues

Addresses napari/napari-sphinx-theme#113
Depends on napari/napari-sphinx-theme#134
  • Loading branch information
melissawm authored Jan 18, 2024
1 parent 4066c20 commit 9855a4d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 20 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install "napari/[all]"
python -m pip install -r docs/requirements.txt
env:
PIP_CONSTRAINT: ${{ github.workspace }}/napari/resources/constraints/constraints_py3.10_docs.txt

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install "napari-repo/[all]" -c "napari-repo/resources/constraints/constraints_py3.10_docs.txt"
python -m pip install -r docs/requirements.txt -c "napari-repo/resources/constraints/constraints_py3.10_docs.txt"
- name: Testing
run: |
python -c 'import napari; print(napari.__version__)'
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "!layout.html" %}
{% extends "!napari-layout.html" %}
{% block extrahead %}
<script async defer data-domain="napari.org" src="https://plausible.io/js/plausible.js"></script>
{{ super() }}
Expand Down
3 changes: 0 additions & 3 deletions docs/_templates/sbt-sidebar-nav.html

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_templates/sidebar-nav-bs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<nav class="bd-docs-nav bd-links"
aria-label="{{ _('Section Navigation') }}">
<div class="bd-toc-item navbar-nav">{{ sidebar_nav_html }}</div>
</nav>
64 changes: 57 additions & 7 deletions docs/community/meeting_schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,61 @@

We hold regular meetings, the timings of which are available on our [public calendar](https://calendar.google.com/calendar/embed?src=c_35r93ec6vtp8smhm7dv5uot0v4%40group.calendar.google.com).

```{calendar}
---
show-filters: true
calendar-id: [email protected]
---
```

If you are using napari or interested in how napari could be used in your work, please join one of our regular community meetings. If you're interested in diving deep on particular topic you could join the closest working group meeting. We currently have four working groups 'Bundled Application', 'Plugins', 'Architecture', and 'Documentation' that meet on a semi-regular candence. You can learn more about our working groups and community meetings in the corresponding discussion streams on the [napari Zulip](https://napari.zulipchat.com/login/).

<div id='community_calendar'></div>

<div id='timezone'></div>

<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">&times;</span>
<h3>Event details</h3>
</div>
<div id="details" class="modal-body">
</div>
</div>
</div>

<script src='https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js'></script>
<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/[email protected]/index.global.min.js"></script>
<script>
document.getElementById('timezone').innerHTML = "All times shown in "+Intl.DateTimeFormat().resolvedOptions().timeZone+".";
document.addEventListener('DOMContentLoaded', function () {
var community_calendar = document.getElementById('community_calendar');
var calendar = new FullCalendar.Calendar(community_calendar,
{
height: 650,
timeZone: 'local',
initialView: 'dayGridMonth',
headerToolbar: {
left: "prev,next today",
center: "title",
right: "dayGridMonth,listWeek",
},
googleCalendarApiKey: '{API_KEY}',
events: {
googleCalendarId: '[email protected]',
},
eventClick: function (info) {
info.jsEvent.preventDefault();
var eventObj = info.event;
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// Get the modal
var modal = document.getElementById("myModal");
modal.style.display = "block";
var eventTitle = eventObj.title.charAt(0).toUpperCase() + eventObj.title.slice(1);
document.getElementById("details").innerHTML = '<b>' + eventTitle + '</b>' + '<br>' + eventObj.extendedProps.description;
//When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
},
eventDisplay: 'block',
});
calendar.render();
});
</script>
32 changes: 27 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# sys.path.insert(0, os.path.abspath('.'))

import re
import os
from importlib import import_module
from pathlib import Path
from urllib.parse import urlparse, urlunparse
Expand Down Expand Up @@ -83,7 +84,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'napari'
html_theme = 'napari_sphinx_theme'

# Define the json_url for our version switcher.
json_url = "https://napari.org/dev/_static/version_switcher.json"
Expand All @@ -98,12 +99,17 @@
{"name": "napari hub", "url": "https://napari-hub.org"}
],
"github_url": "https://github.com/napari/napari",
"navbar_start": ["navbar-project"],
"navbar_start": ["navbar-logo", "navbar-project"],
"navbar_end": ["version-switcher", "navbar-icon-links"],
"switcher": {
"json_url": json_url,
"version_match": version_match,
},
"navbar_persistent": [],
"header_links_before_dropdown": 6,
"secondary_sidebar_items": ["page-toc"],
"pygment_light_style": "napari",
"pygment_dark_style": "napari",
}

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down Expand Up @@ -262,15 +268,31 @@ def napari_scraper(block, block_vars, gallery_conf):
'within_subsection_order': ExampleTitleSortKey,
}

GOOGLE_CALENDAR_API_KEY = os.environ.get('GOOGLE_CALENDAR_API_KEY', '')


def add_google_calendar_secrets(app, docname, source):
"""Add google calendar api key to meeting schedule page.
The source argument is a list whose single element is the contents of the
source file. You can process the contents and replace this item to implement
source-level transformations.
"""
if docname == 'community/meeting_schedule':
source[0] = source[0].replace('{API_KEY}', GOOGLE_CALENDAR_API_KEY)


def setup(app):
"""Ignore .ipynb files.
"""Set up docs build.
Prevents sphinx from complaining about multiple files found for document
when generating the gallery.
* Ignores .ipynb files to prevent sphinx from complaining about multiple
files found for document when generating the gallery
* Rewrites github anchors to be comparable
* Adds google calendar api key to meetings schedule page
"""
app.registry.source_suffix.pop(".ipynb", None)
app.connect('source-read', add_google_calendar_secrets)
app.connect('linkcheck-process-uri', rewrite_github_anchor)


Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx<5
sphinx<6
sphinx-autobuild
sphinx-tabs
sphinx-tags
Expand All @@ -9,7 +9,7 @@ sphinx-copybutton
sphinx-gallery
sphinx_autodoc_typehints==1.12.0
myst-nb
napari-sphinx-theme
napari-sphinx-theme>=0.3.0.dev0
matplotlib
lxml
imageio-ffmpeg

0 comments on commit 9855a4d

Please sign in to comment.