From df5dc06d701702e2b16493d2a77745630b348277 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Tue, 10 May 2022 20:44:06 +1000 Subject: [PATCH 01/17] deploy dev --- .github/workflows/deploy-docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index cd33b687..71e674c7 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -54,6 +54,8 @@ jobs: with: branch: gh-pages folder: doc/_build/html + target-folder: dev + clean: true - name: Cache uses: actions/cache@v2 From 42bf22b775315695f4d23b20e211c7cd359b827d Mon Sep 17 00:00:00 2001 From: lucy liu Date: Wed, 18 May 2022 13:30:42 +1000 Subject: [PATCH 02/17] deploy dev and stable docs --- .github/workflows/deploy-docs.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 71e674c7..843a26d5 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -49,7 +49,7 @@ jobs: working-directory: doc run: make html - - name: Deploy docs 🚀 + - name: Deploy dev docs 🚀 uses: JamesIves/github-pages-deploy-action@4.1.5 with: branch: gh-pages @@ -57,6 +57,15 @@ jobs: target-folder: dev clean: true + - name: Deploy stable docs 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.5 + if: startsWith(${{ github.ref_name }}, 'v*') + with: + branch: gh-pages + folder: doc/_build/html + target-folder: ${{ github.ref_name }} + clean: true + - name: Cache uses: actions/cache@v2 with: From caaf98ffb3f3b30b2e54c372dc6526ef1aad8999 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 19 May 2022 13:33:20 +1000 Subject: [PATCH 03/17] use major ver dirs --- .github/workflows/deploy-docs.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 843a26d5..13d530f4 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -22,6 +22,14 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Get TAG + run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + + - name: Get DOC_DIR + run: | + DOC_DIR="${TAG%.*}".x + echo "DOC_DIR=${DOC_DIR:1}" >> $GITHUB_ENV + - name: Set up Qt uses: tlambert03/setup-qt-libs@v1 @@ -59,11 +67,11 @@ jobs: - name: Deploy stable docs 🚀 uses: JamesIves/github-pages-deploy-action@4.1.5 - if: startsWith(${{ github.ref_name }}, 'v*') + if: startsWith(env.TAG, 'v') with: branch: gh-pages folder: doc/_build/html - target-folder: ${{ github.ref_name }} + target-folder: ${{ env.DOC_DIR }} clean: true - name: Cache From 37c0f3797f55ef2b1f7276fb214e88149f8d9670 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 19 May 2022 17:11:35 +1000 Subject: [PATCH 04/17] use pydata theme, fix deploy docs --- .github/workflows/deploy-docs.yml | 4 ++-- doc/_static/version_switcher.json | 34 +++++++++++++++++++++++++++++++ doc/conf.py | 11 +++++++--- requirements/doc.txt | 2 +- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 doc/_static/version_switcher.json diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 13d530f4..ad15c56b 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -27,8 +27,8 @@ jobs: - name: Get DOC_DIR run: | - DOC_DIR="${TAG%.*}".x - echo "DOC_DIR=${DOC_DIR:1}" >> $GITHUB_ENV + DOC_DIR="$(cut -d '.' -f 1,2 <<< "$TAG")" + echo "DOC_DIR=${DOC_DIR:1}".x >> $GITHUB_ENV - name: Set up Qt uses: tlambert03/setup-qt-libs@v1 diff --git a/doc/_static/version_switcher.json b/doc/_static/version_switcher.json new file mode 100644 index 00000000..ce67b5b1 --- /dev/null +++ b/doc/_static/version_switcher.json @@ -0,0 +1,34 @@ +[ + { + "version": "0.1.x", + "url": "https://jni.github.io/skan/0.1.x" + }, + { + "version": "0.3.x", + "url": "https://jni.github.io/skan/0.3.x" + }, + { + "version": "0.5.x", + "url": "https://jni.github.io/skan/0.5.x" + }, + { + "version": "0.6.x", + "url": "https://jni.github.io/skan/0.6.x" + }, + { + "version": "0.7.x", + "url": "https://jni.github.io/skan/0.7.x" + }, + { + "version": "0.8.x", + "url": "https://jni.github.io/skan/0.8.x" + }, + { + "version": "0.9.x", + "url": "https://jni.github.io/skan/0.9.x" + }, + { + "version": "0.10.x", + "url": "https://jni.github.io/skan/0.10.x" + } +] \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 357d4905..da72d483 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -104,20 +104,25 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_material' +html_theme = 'pydata_sphinx_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # -html_theme = 'sphinx_material' +version = skan.__version__.replace('dev0', '') # Material theme options (see theme.conf for more information) html_theme_options = { # Set the name of the project to appear in the navigation. 'nav_title': 'Skan ðŸĶī📏', - + # pydata theme version switcher config + 'navbar_end': ['version-switcher', 'navbar-icon-links'], + 'switcher': { + 'json_url': 'https://jni.github.io/skan/dev/_static/version_switcher.json', + 'version_match': version, + }, # Set you GA account ID to enable tracking # 'google_analytics_account': 'UA-XXXXX', diff --git a/requirements/doc.txt b/requirements/doc.txt index e939ccf8..56a10c79 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -5,5 +5,5 @@ tqdm>=4.11 nb2plots>=0.5 sphinxcontrib-bibtex sphinx<2 -sphinx_rtd_theme +pydata-sphinx-theme>=0.8.1 seaborn>=0.9 From 0c85b075defa355879ce3d5758957a733f63817d Mon Sep 17 00:00:00 2001 From: lucy liu Date: Mon, 23 May 2022 16:11:22 +1000 Subject: [PATCH 05/17] add pydata to doc dep --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 4202cf5d..4a3cab44 100644 --- a/setup.cfg +++ b/setup.cfg @@ -87,3 +87,4 @@ docs = sphinxcontrib-bibtex myst-nb zarr + pydata-sphinx-theme>=0.8.1 From 7d822e1b95211952154485e8f754c1eb8f6be69d Mon Sep 17 00:00:00 2001 From: lucy liu Date: Mon, 23 May 2022 16:38:57 +1000 Subject: [PATCH 06/17] remove alabaster stuff --- doc/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index da72d483..15d77822 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -156,9 +156,9 @@ # # This is required for the alabaster theme # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -html_sidebars = { - "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"] -} +# html_sidebars = { +# "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"] +# } # -- Options for HTMLHelp output ------------------------------------------ From 4051d8b97959ce0d7a6ce597b5d3e36d690ab10b Mon Sep 17 00:00:00 2001 From: lucy liu Date: Tue, 24 May 2022 11:27:27 +1000 Subject: [PATCH 07/17] double check deploy --- .github/workflows/deploy-docs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index ad15c56b..16be9f15 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -29,6 +29,8 @@ jobs: run: | DOC_DIR="$(cut -d '.' -f 1,2 <<< "$TAG")" echo "DOC_DIR=${DOC_DIR:1}".x >> $GITHUB_ENV + - name: test + echo ${{ env.DOC_DIR }} - name: Set up Qt uses: tlambert03/setup-qt-libs@v1 From c379c96f4aaf2add7fea1473a16404ab68d237c3 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Tue, 24 May 2022 17:22:49 +1000 Subject: [PATCH 08/17] remove old versions --- .github/workflows/deploy-docs.yml | 2 -- doc/_static/version_switcher.json | 29 +++++++++-------------------- doc/conf.py | 21 ++++++--------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 16be9f15..ad15c56b 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -29,8 +29,6 @@ jobs: run: | DOC_DIR="$(cut -d '.' -f 1,2 <<< "$TAG")" echo "DOC_DIR=${DOC_DIR:1}".x >> $GITHUB_ENV - - name: test - echo ${{ env.DOC_DIR }} - name: Set up Qt uses: tlambert03/setup-qt-libs@v1 diff --git a/doc/_static/version_switcher.json b/doc/_static/version_switcher.json index ce67b5b1..fcc3bf5f 100644 --- a/doc/_static/version_switcher.json +++ b/doc/_static/version_switcher.json @@ -1,34 +1,23 @@ [ { - "version": "0.1.x", - "url": "https://jni.github.io/skan/0.1.x" + "name": "dev", + "version": "0.11.0.dev0", + "url": "https://jni.github.io/skan/dev" }, { - "version": "0.3.x", - "url": "https://jni.github.io/skan/0.3.x" - }, - { - "version": "0.5.x", - "url": "https://jni.github.io/skan/0.5.x" - }, - { - "version": "0.6.x", - "url": "https://jni.github.io/skan/0.6.x" + "version": "0.10.x", + "url": "https://jni.github.io/skan/0.10.x" }, { - "version": "0.7.x", - "url": "https://jni.github.io/skan/0.7.x" + "version": "0.9.x", + "url": "https://jni.github.io/skan/0.9.x" }, { "version": "0.8.x", "url": "https://jni.github.io/skan/0.8.x" }, { - "version": "0.9.x", - "url": "https://jni.github.io/skan/0.9.x" - }, - { - "version": "0.10.x", - "url": "https://jni.github.io/skan/0.10.x" + "version": "0.7.x", + "url": "https://jni.github.io/skan/0.7.x" } ] \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 15d77822..929741c6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -138,12 +138,12 @@ 'repo_url': 'https://github.com/jni/skan/', 'repo_name': 'Skan', - # Visible levels of the global TOC; -1 means unlimited - 'globaltoc_depth': 1, - # If False, expand all TOC entries - 'globaltoc_collapse': False, - # If True, show hidden TOC entries - 'globaltoc_includehidden': False, +# # Visible levels of the global TOC; -1 means unlimited +# 'globaltoc_depth': 1, +# # If False, expand all TOC entries +# 'globaltoc_collapse': False, +# # If True, show hidden TOC entries +# 'globaltoc_includehidden': False, } # Add any paths that contain custom static files (such as style sheets) here, @@ -151,15 +151,6 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# This is required for the alabaster theme -# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -# html_sidebars = { -# "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"] -# } - # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. From 3e20d4c3fbe6a6e9fe7094844bdbed8e1b954027 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Wed, 1 Jun 2022 13:49:07 +1000 Subject: [PATCH 09/17] update toc, update conf and version switcher --- doc/_static/version_switcher.json | 17 +++++------------ doc/conf.py | 5 +++-- doc/{ => examples}/complete_analysis.md | 0 doc/examples/index.rst | 13 +++++++++++++ doc/{ => examples}/sholl_analysis.md | 0 doc/{ => examples}/visualizing_3d_skeletons.md | 0 doc/{ => getting_started}/getting_started.md | 0 doc/getting_started/index.rst | 12 ++++++++++++ doc/{ => getting_started}/install.rst | 0 doc/index.rst | 15 +++++---------- doc/{ => misc}/citing.rst | 0 doc/{ => misc}/faq.md | 0 doc/misc/index.rst | 12 ++++++++++++ doc/{ => misc}/release-notes/index.rst | 0 doc/{ => misc}/release-notes/release-latest.md | 0 doc/{ => misc}/release-notes/release-v0.10.0.md | 0 doc/{ => misc}/release-notes/release-v0.9.md | 0 17 files changed, 50 insertions(+), 24 deletions(-) rename doc/{ => examples}/complete_analysis.md (100%) create mode 100644 doc/examples/index.rst rename doc/{ => examples}/sholl_analysis.md (100%) rename doc/{ => examples}/visualizing_3d_skeletons.md (100%) rename doc/{ => getting_started}/getting_started.md (100%) create mode 100644 doc/getting_started/index.rst rename doc/{ => getting_started}/install.rst (100%) rename doc/{ => misc}/citing.rst (100%) rename doc/{ => misc}/faq.md (100%) create mode 100644 doc/misc/index.rst rename doc/{ => misc}/release-notes/index.rst (100%) rename doc/{ => misc}/release-notes/release-latest.md (100%) rename doc/{ => misc}/release-notes/release-v0.10.0.md (100%) rename doc/{ => misc}/release-notes/release-v0.9.md (100%) diff --git a/doc/_static/version_switcher.json b/doc/_static/version_switcher.json index fcc3bf5f..3d81976c 100644 --- a/doc/_static/version_switcher.json +++ b/doc/_static/version_switcher.json @@ -2,22 +2,15 @@ { "name": "dev", "version": "0.11.0.dev0", - "url": "https://jni.github.io/skan/dev" + "url": "https://lucyleeow.github.io/skan/dev" }, { + "name": "0.10.x (stable)", "version": "0.10.x", - "url": "https://jni.github.io/skan/0.10.x" + "url": "https://lucyleeow.github.io/skan/0.10.x" }, { "version": "0.9.x", - "url": "https://jni.github.io/skan/0.9.x" - }, - { - "version": "0.8.x", - "url": "https://jni.github.io/skan/0.8.x" - }, - { - "version": "0.7.x", - "url": "https://jni.github.io/skan/0.7.x" + "url": "https://lucyleeow.github.io/skan/0.9.x" } -] \ No newline at end of file +] diff --git a/doc/conf.py b/doc/conf.py index 929741c6..000a72d4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -111,8 +111,6 @@ # documentation. # -version = skan.__version__.replace('dev0', '') - # Material theme options (see theme.conf for more information) html_theme_options = { # Set the name of the project to appear in the navigation. @@ -146,6 +144,9 @@ # 'globaltoc_includehidden': False, } +if 'dev' in version: + html_theme_options["switcher"]["version_match"] = "dev" + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". diff --git a/doc/complete_analysis.md b/doc/examples/complete_analysis.md similarity index 100% rename from doc/complete_analysis.md rename to doc/examples/complete_analysis.md diff --git a/doc/examples/index.rst b/doc/examples/index.rst new file mode 100644 index 00000000..7a72a198 --- /dev/null +++ b/doc/examples/index.rst @@ -0,0 +1,13 @@ +======== +Examples +======== + +skan examples. + + +.. toctree:: + :maxdepth: 1 + + complete_analysis + sholl_analysis + visualizing_3d_skeletons diff --git a/doc/sholl_analysis.md b/doc/examples/sholl_analysis.md similarity index 100% rename from doc/sholl_analysis.md rename to doc/examples/sholl_analysis.md diff --git a/doc/visualizing_3d_skeletons.md b/doc/examples/visualizing_3d_skeletons.md similarity index 100% rename from doc/visualizing_3d_skeletons.md rename to doc/examples/visualizing_3d_skeletons.md diff --git a/doc/getting_started.md b/doc/getting_started/getting_started.md similarity index 100% rename from doc/getting_started.md rename to doc/getting_started/getting_started.md diff --git a/doc/getting_started/index.rst b/doc/getting_started/index.rst new file mode 100644 index 00000000..9e627620 --- /dev/null +++ b/doc/getting_started/index.rst @@ -0,0 +1,12 @@ +=============== +Getting started +=============== + +Getting started with skan. + + +.. toctree:: + :maxdepth: 1 + + install + getting_started diff --git a/doc/install.rst b/doc/getting_started/install.rst similarity index 100% rename from doc/install.rst rename to doc/getting_started/install.rst diff --git a/doc/index.rst b/doc/index.rst index ef75ee1c..f8ee22c8 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -9,18 +9,13 @@ Skeleton analysis with Skan ðŸĶī📏 Skan is a pure Python library to analyse skeleton images. .. toctree:: - :maxdepth: 1 + :maxdepth: 3 - install - getting_started - gui - complete_analysis - visualizing_3d_skeletons - sholl_analysis - faq - citing + getting_started/index + examples/index api/api - release-notes/index + gui + Miscellaneous Indices and tables diff --git a/doc/citing.rst b/doc/misc/citing.rst similarity index 100% rename from doc/citing.rst rename to doc/misc/citing.rst diff --git a/doc/faq.md b/doc/misc/faq.md similarity index 100% rename from doc/faq.md rename to doc/misc/faq.md diff --git a/doc/misc/index.rst b/doc/misc/index.rst new file mode 100644 index 00000000..8ce29c42 --- /dev/null +++ b/doc/misc/index.rst @@ -0,0 +1,12 @@ +============= +Miscellaneous +============= + +FAQ, release notes and how to cite skan. + +.. toctree:: + :maxdepth: 3 + + faq + release-notes/index + citing diff --git a/doc/release-notes/index.rst b/doc/misc/release-notes/index.rst similarity index 100% rename from doc/release-notes/index.rst rename to doc/misc/release-notes/index.rst diff --git a/doc/release-notes/release-latest.md b/doc/misc/release-notes/release-latest.md similarity index 100% rename from doc/release-notes/release-latest.md rename to doc/misc/release-notes/release-latest.md diff --git a/doc/release-notes/release-v0.10.0.md b/doc/misc/release-notes/release-v0.10.0.md similarity index 100% rename from doc/release-notes/release-v0.10.0.md rename to doc/misc/release-notes/release-v0.10.0.md diff --git a/doc/release-notes/release-v0.9.md b/doc/misc/release-notes/release-v0.9.md similarity index 100% rename from doc/release-notes/release-v0.9.md rename to doc/misc/release-notes/release-v0.9.md From 3f01aea043edbfbb0ee0910d5854cc0f7e103369 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Wed, 1 Jun 2022 14:17:32 +1000 Subject: [PATCH 10/17] fix urls in version switcher --- doc/_static/version_switcher.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/_static/version_switcher.json b/doc/_static/version_switcher.json index 3d81976c..92d51944 100644 --- a/doc/_static/version_switcher.json +++ b/doc/_static/version_switcher.json @@ -2,15 +2,15 @@ { "name": "dev", "version": "0.11.0.dev0", - "url": "https://lucyleeow.github.io/skan/dev" + "url": "https://jni.github.io/skan/dev" }, { "name": "0.10.x (stable)", "version": "0.10.x", - "url": "https://lucyleeow.github.io/skan/0.10.x" + "url": "https://jni.github.io/skan/0.10.x" }, { "version": "0.9.x", - "url": "https://lucyleeow.github.io/skan/0.9.x" + "url": "https://jni.github.io/skan/0.9.x" } ] From 8b9d27232377d0489fd66197c434e237c92f7b36 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Wed, 1 Jun 2022 14:18:20 +1000 Subject: [PATCH 11/17] remove old toc tree items --- doc/conf.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 000a72d4..74a43139 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -136,12 +136,6 @@ 'repo_url': 'https://github.com/jni/skan/', 'repo_name': 'Skan', -# # Visible levels of the global TOC; -1 means unlimited -# 'globaltoc_depth': 1, -# # If False, expand all TOC entries -# 'globaltoc_collapse': False, -# # If True, show hidden TOC entries -# 'globaltoc_includehidden': False, } if 'dev' in version: From 7d9bf63aca96086919791c053d83c14835594067 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Wed, 1 Jun 2022 15:04:11 +1000 Subject: [PATCH 12/17] fix example data dir --- doc/examples/sholl_analysis.md | 2 +- doc/getting_started/getting_started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/examples/sholl_analysis.md b/doc/examples/sholl_analysis.md index 6e9aed1f..68a47ac2 100644 --- a/doc/examples/sholl_analysis.md +++ b/doc/examples/sholl_analysis.md @@ -26,7 +26,7 @@ import matplotlib.pyplot as plt import numpy as np import zarr -neuron = np.asarray(zarr.open('example-data/neuron.zarr.zip')) +neuron = np.asarray(zarr.open('../example-data/neuron.zarr.zip')) fig, ax = plt.subplots() ax.imshow(neuron, cmap='gray') diff --git a/doc/getting_started/getting_started.md b/doc/getting_started/getting_started.md index a03df85c..f35a378b 100644 --- a/doc/getting_started/getting_started.md +++ b/doc/getting_started/getting_started.md @@ -25,7 +25,7 @@ First, we load the images. These images were produced by an FEI scanning electro from glob import glob import imageio as iio -files = glob('example-data/*.tif') +files = glob('../example-data/*.tif') image0 = iio.imread(files[0], format='fei') ``` From 37253d444bdb9b6e81db2fdb939f8132279687c3 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 2 Jun 2022 13:43:42 +1000 Subject: [PATCH 13/17] fix version match --- doc/conf.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 74a43139..65741e19 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -19,6 +19,7 @@ # Add the local code to the Python path, so docs are generated for # current working copy import os +import re import sys rundir = os.path.dirname(__file__) @@ -111,6 +112,16 @@ # documentation. # +# Version match must match the 'version' key in version_swticher.json +pattern = re.compile(r'^v[0-9]+\.[0-9]+') +version_match = pattern.search(version).group() +if version_match: + version_match = version_match[1:] + ".x" +elif 'dev' in version: + version_match = "dev" +else: + version_match = version + # Material theme options (see theme.conf for more information) html_theme_options = { # Set the name of the project to appear in the navigation. @@ -138,9 +149,6 @@ } -if 'dev' in version: - html_theme_options["switcher"]["version_match"] = "dev" - # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". From c784d19af25cfa0f35f9e9d0a6ac39dc449c3e45 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 2 Jun 2022 14:23:00 +1000 Subject: [PATCH 14/17] amend version switcher stable, fix version match --- doc/_static/version_switcher.json | 2 +- doc/conf.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/_static/version_switcher.json b/doc/_static/version_switcher.json index 92d51944..58762262 100644 --- a/doc/_static/version_switcher.json +++ b/doc/_static/version_switcher.json @@ -7,7 +7,7 @@ { "name": "0.10.x (stable)", "version": "0.10.x", - "url": "https://jni.github.io/skan/0.10.x" + "url": "https://jni.github.io/skan/stable" }, { "version": "0.9.x", diff --git a/doc/conf.py b/doc/conf.py index 65741e19..2c50341d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -114,9 +114,9 @@ # Version match must match the 'version' key in version_swticher.json pattern = re.compile(r'^v[0-9]+\.[0-9]+') -version_match = pattern.search(version).group() -if version_match: - version_match = version_match[1:] + ".x" +version_match = pattern.search(version) +if version_match.group(): + version_match = version_match.group[1:] + ".x" elif 'dev' in version: version_match = "dev" else: @@ -130,7 +130,7 @@ 'navbar_end': ['version-switcher', 'navbar-icon-links'], 'switcher': { 'json_url': 'https://jni.github.io/skan/dev/_static/version_switcher.json', - 'version_match': version, + 'version_match': version_match, }, # Set you GA account ID to enable tracking # 'google_analytics_account': 'UA-XXXXX', From e67b516c5bb9fd23a93931431d7a23367187be09 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 2 Jun 2022 14:25:07 +1000 Subject: [PATCH 15/17] fix typo --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 2c50341d..e81f54e8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -116,7 +116,7 @@ pattern = re.compile(r'^v[0-9]+\.[0-9]+') version_match = pattern.search(version) if version_match.group(): - version_match = version_match.group[1:] + ".x" + version_match = version_match.group()[1:] + ".x" elif 'dev' in version: version_match = "dev" else: From 117e89272fdfec2f6978938a7ec647cd4e4e2cc4 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 2 Jun 2022 14:40:18 +1000 Subject: [PATCH 16/17] typo --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index e81f54e8..bee4ca15 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -115,7 +115,7 @@ # Version match must match the 'version' key in version_swticher.json pattern = re.compile(r'^v[0-9]+\.[0-9]+') version_match = pattern.search(version) -if version_match.group(): +if version_match: version_match = version_match.group()[1:] + ".x" elif 'dev' in version: version_match = "dev" From 15b84cedf7c25fb5f077e1d88f34bebbe1550041 Mon Sep 17 00:00:00 2001 From: lucy liu Date: Thu, 2 Jun 2022 17:11:59 +1000 Subject: [PATCH 17/17] fix version match --- doc/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index bee4ca15..cfc0697a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -113,10 +113,10 @@ # # Version match must match the 'version' key in version_swticher.json -pattern = re.compile(r'^v[0-9]+\.[0-9]+') +pattern = re.compile(r'^[0-9]+\.[0-9]+') version_match = pattern.search(version) if version_match: - version_match = version_match.group()[1:] + ".x" + version_match = version_match.group() + ".x" elif 'dev' in version: version_match = "dev" else: