From 69ec5744f3ddd2c9f01eaf76d7ef1ceb8f5a99a6 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Fri, 10 Jul 2026 19:39:39 -0300 Subject: [PATCH] add ioos header --- .github/workflows/deploy-docs.yml | 1 + .pre-commit-config.yaml | 4 ++-- jupyterbook/_config.yml | 5 +++-- jupyterbook/add_header.py | 24 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 jupyterbook/add_header.py diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index dd95f62a..7ba0d71f 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -33,6 +33,7 @@ jobs: set -e && pip install "jupyter-book<2" && jupyter-book build jupyterbook + && python jupyterbook/add_header.py - name: GitHub Pages action if: success() && github.event_name == 'release' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98e935ef..e6589fc2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: add-trailing-comma - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.20 + rev: v0.15.22 hooks: - id: ruff @@ -55,7 +55,7 @@ repos: - id: nb-strip-paths - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.26.1 + rev: v1.28.0 hooks: - id: zizmor diff --git a/jupyterbook/_config.yml b/jupyterbook/_config.yml index 1ee27138..dd3de465 100644 --- a/jupyterbook/_config.yml +++ b/jupyterbook/_config.yml @@ -1,5 +1,5 @@ # Book settings -title: The U.S. Integrated Ocean Observing System (IOOS) # The title of the book. Will be placed in the left navbar. +title: The U.S. Integrated Ocean Observing System (IOOS) author: IOOS # The author of the book logo: images/IOOS_logo.png # A path to the book logo @@ -44,7 +44,8 @@ html: use_edit_page_button: false # Whether to add an "edit this page" button to pages. If `true`, repository information in repository: must be filled in use_repository_button: true # Whether to add a link to your repository button use_issues_button: true # Whether to add an "open an issue" button - extra_navbar: IOOS # Will be displayed underneath the left navbar. + # Hitting https://github.com/jupyter-book/jupyter-book/issues/1966 + extra_navbar: IOOS extra_footer: ioos.noaa.gov   Facebook   Twitter   diff --git a/jupyterbook/add_header.py b/jupyterbook/add_header.py new file mode 100644 index 00000000..27cbddb2 --- /dev/null +++ b/jupyterbook/add_header.py @@ -0,0 +1,24 @@ +from pathlib import Path + +path = Path(__file__).absolute().parent + + +def add_header(fname): + ioos_ui_components_min_js = """\n\n""" + ioos_header = """\n\n""" + + with open(fname) as f: + lines = f.readlines() + + with open(fname, "w") as out: + for line in lines: + if line.strip().startswith("