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 @@