From 2a7eaa5ae34fdedf1b074ed8cf9ea40603dc32c9 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 17 Mar 2023 09:07:53 +0100 Subject: [PATCH] Versioned docs! --- .gitignore | 1 - _config.yml | 2 +- implementations/python/Makefile | 11 +++- implementations/python/mkdocs.yml | 7 ++- implementations/python/update-doc-versions.sh | 18 ++++++ python/.gitignore | 1 + python/{ => 0.18.0}/404.html | 44 +++++++------ python/{ => 0.18.0}/api/index.html | 8 ++- python/{ => 0.18.0}/assets/_mkdocstrings.css | 0 python/{ => 0.18.0}/assets/images/favicon.png | Bin .../assets/javascripts/bundle.efa0ade1.min.js | 0 .../javascripts/bundle.efa0ade1.min.js.map | 0 .../javascripts/lunr/min/lunr.ar.min.js | 0 .../javascripts/lunr/min/lunr.da.min.js | 0 .../javascripts/lunr/min/lunr.de.min.js | 0 .../javascripts/lunr/min/lunr.du.min.js | 0 .../javascripts/lunr/min/lunr.es.min.js | 0 .../javascripts/lunr/min/lunr.fi.min.js | 0 .../javascripts/lunr/min/lunr.fr.min.js | 0 .../javascripts/lunr/min/lunr.hi.min.js | 0 .../javascripts/lunr/min/lunr.hu.min.js | 0 .../javascripts/lunr/min/lunr.it.min.js | 0 .../javascripts/lunr/min/lunr.ja.min.js | 0 .../javascripts/lunr/min/lunr.jp.min.js | 0 .../javascripts/lunr/min/lunr.ko.min.js | 0 .../javascripts/lunr/min/lunr.multi.min.js | 0 .../javascripts/lunr/min/lunr.nl.min.js | 0 .../javascripts/lunr/min/lunr.no.min.js | 0 .../javascripts/lunr/min/lunr.pt.min.js | 0 .../javascripts/lunr/min/lunr.ro.min.js | 0 .../javascripts/lunr/min/lunr.ru.min.js | 0 .../lunr/min/lunr.stemmer.support.min.js | 0 .../javascripts/lunr/min/lunr.sv.min.js | 0 .../javascripts/lunr/min/lunr.ta.min.js | 0 .../javascripts/lunr/min/lunr.th.min.js | 0 .../javascripts/lunr/min/lunr.tr.min.js | 0 .../javascripts/lunr/min/lunr.vi.min.js | 0 .../javascripts/lunr/min/lunr.zh.min.js | 0 .../assets/javascripts/lunr/tinyseg.js | 0 .../assets/javascripts/lunr/wordcut.js | 0 .../workers/search.208ed371.min.js | 0 .../workers/search.208ed371.min.js.map | 0 .../assets/stylesheets/main.c4a75a56.min.css | 0 .../stylesheets/main.c4a75a56.min.css.map | 0 .../stylesheets/palette.a0c5b2b5.min.css | 0 .../stylesheets/palette.a0c5b2b5.min.css.map | 0 python/{ => 0.18.0}/binary/index.html | 8 ++- python/{ => 0.18.0}/compare/index.html | 8 ++- python/{ => 0.18.0}/error/index.html | 8 ++- python/{ => 0.18.0}/fold/index.html | 8 ++- python/{ => 0.18.0}/index.html | 8 ++- python/{ => 0.18.0}/merge/index.html | 8 ++- python/{ => 0.18.0}/objects.inv | Bin python/{ => 0.18.0}/path/index.html | 8 ++- python/{ => 0.18.0}/schema/index.html | 8 ++- python/{ => 0.18.0}/search/search_index.json | 0 python/0.18.0/sitemap.xml | 58 ++++++++++++++++++ python/{ => 0.18.0}/text/index.html | 8 ++- python/{ => 0.18.0}/values/index.html | 8 ++- python/index.md | 10 +++ python/latest | 1 + python/sitemap.xml | 58 ------------------ python/versions.json | 4 ++ 63 files changed, 196 insertions(+), 107 deletions(-) create mode 100755 implementations/python/update-doc-versions.sh create mode 100644 python/.gitignore rename python/{ => 0.18.0}/404.html (81%) rename python/{ => 0.18.0}/api/index.html (98%) rename python/{ => 0.18.0}/assets/_mkdocstrings.css (100%) rename python/{ => 0.18.0}/assets/images/favicon.png (100%) rename python/{ => 0.18.0}/assets/javascripts/bundle.efa0ade1.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/bundle.efa0ade1.min.js.map (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ar.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.da.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.de.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.du.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.es.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.fi.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.fr.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.hi.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.hu.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.it.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ja.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.jp.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ko.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.multi.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.nl.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.no.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.pt.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ro.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ru.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.stemmer.support.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.sv.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.ta.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.th.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.tr.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.vi.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/min/lunr.zh.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/tinyseg.js (100%) rename python/{ => 0.18.0}/assets/javascripts/lunr/wordcut.js (100%) rename python/{ => 0.18.0}/assets/javascripts/workers/search.208ed371.min.js (100%) rename python/{ => 0.18.0}/assets/javascripts/workers/search.208ed371.min.js.map (100%) rename python/{ => 0.18.0}/assets/stylesheets/main.c4a75a56.min.css (100%) rename python/{ => 0.18.0}/assets/stylesheets/main.c4a75a56.min.css.map (100%) rename python/{ => 0.18.0}/assets/stylesheets/palette.a0c5b2b5.min.css (100%) rename python/{ => 0.18.0}/assets/stylesheets/palette.a0c5b2b5.min.css.map (100%) rename python/{ => 0.18.0}/binary/index.html (99%) rename python/{ => 0.18.0}/compare/index.html (99%) rename python/{ => 0.18.0}/error/index.html (98%) rename python/{ => 0.18.0}/fold/index.html (99%) rename python/{ => 0.18.0}/index.html (98%) rename python/{ => 0.18.0}/merge/index.html (99%) rename python/{ => 0.18.0}/objects.inv (100%) rename python/{ => 0.18.0}/path/index.html (98%) rename python/{ => 0.18.0}/schema/index.html (99%) rename python/{ => 0.18.0}/search/search_index.json (100%) create mode 100644 python/0.18.0/sitemap.xml rename python/{ => 0.18.0}/text/index.html (99%) rename python/{ => 0.18.0}/values/index.html (99%) create mode 100644 python/index.md create mode 120000 python/latest delete mode 100644 python/sitemap.xml create mode 100644 python/versions.json diff --git a/.gitignore b/.gitignore index 5f432e6..1fc3cf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -/python/sitemap.xml.gz _site/ preserves-binary.pdf preserves-schema.pdf diff --git a/_config.yml b/_config.yml index 0e77be8..52f1c49 100644 --- a/_config.yml +++ b/_config.yml @@ -1,4 +1,4 @@ -exclude: [implementations] +exclude: [implementations, scratch] markdown: kramdown highlighter: rouge diff --git a/implementations/python/Makefile b/implementations/python/Makefile index beec5a7..3e812ea 100644 --- a/implementations/python/Makefile +++ b/implementations/python/Makefile @@ -1,10 +1,15 @@ +PACKAGEVERSION="`python3 setup.py --version`" + all: test build-docs test: update-test-data python3 -m unittest discover -s tests build-docs: - mkdocs build + mkdocs build -d ../../python/$(PACKAGEVERSION) + rm -f ../../python/latest + ln -s $(PACKAGEVERSION) ../../python/latest + ./update-doc-versions.sh serve-docs: mkdocs serve @@ -17,7 +22,7 @@ update-test-data: rsync ../../tests/samples.bin ../../tests/samples.pr tests tag: - git tag python-preserves@`python3 setup.py --version` + git tag python-preserves@$(PACKAGEVERSION) clean: rm -rf htmlcov @@ -31,5 +36,5 @@ clean: publish: clean build twine upload dist/* -build: +build: build-docs python3 setup.py sdist bdist_wheel diff --git a/implementations/python/mkdocs.yml b/implementations/python/mkdocs.yml index ce53c87..c32c7d8 100644 --- a/implementations/python/mkdocs.yml +++ b/implementations/python/mkdocs.yml @@ -1,9 +1,12 @@ site_name: Python Preserves -site_dir: ../../python -site_url: https://preserves.dev/python/ +site_dir: ../../python/dev +site_url: https://preserves.dev/python/latest/ repo_url: https://gitlab.com/preserves/preserves theme: name: material +extra: + version: + provider: mike plugins: - search - mkdocstrings: diff --git a/implementations/python/update-doc-versions.sh b/implementations/python/update-doc-versions.sh new file mode 100755 index 0000000..aad8d57 --- /dev/null +++ b/implementations/python/update-doc-versions.sh @@ -0,0 +1,18 @@ +#!/bin/sh +( + firstitem='y'; + printf '['; + for version in $(ls ../../python/*/sitemap.xml | cut -d/ -f4 | grep -v 'latest' | grep -v 'dev' | sort -V -r) + do + if [ "$firstitem" = "y" ] + then + firstitem=n + aliases='["latest"]' + else + printf ',' + aliases='' + fi + printf '\n {"version":"%s","title":"%s","aliases":%s}' "$version" "$version" "$aliases" + done; + printf '\n]' +) | tee ../../_data/python-versions.json diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 0000000..b3c9c72 --- /dev/null +++ b/python/.gitignore @@ -0,0 +1 @@ +sitemap.xml.gz diff --git a/python/404.html b/python/0.18.0/404.html similarity index 81% rename from python/404.html rename to python/0.18.0/404.html index 557457d..abe23d2 100644 --- a/python/404.html +++ b/python/0.18.0/404.html @@ -10,7 +10,7 @@ - + @@ -19,10 +19,10 @@ - + - + @@ -38,9 +38,9 @@ - + - + @@ -69,6 +69,10 @@ + + @@ -76,7 +80,7 @@