Skip to content

Commit

Permalink
Fix calendar API key definition
Browse files Browse the repository at this point in the history
  • Loading branch information
melissawm committed Nov 6, 2023
1 parent 711b53b commit 3bccb78
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/community/meeting_schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you are using napari or interested in how napari could be used in your work,
center: "title",
right: "dayGridMonth,listWeek",
},
googleCalendarApiKey: api_key,
googleCalendarApiKey: '{API_KEY}',
events: {
googleCalendarId: '[email protected]',
},
Expand Down
23 changes: 20 additions & 3 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 @@ -266,15 +267,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

0 comments on commit 3bccb78

Please sign in to comment.