pax_global_header 0000666 0000000 0000000 00000000064 14455601446 0014523 g ustar 00root root 0000000 0000000 52 comment=313c7765b470c886c326858d10d901370808ea39
mkdocs-redirects-1.2.1/ 0000775 0000000 0000000 00000000000 14455601446 0014766 5 ustar 00root root 0000000 0000000 mkdocs-redirects-1.2.1/.github/ 0000775 0000000 0000000 00000000000 14455601446 0016326 5 ustar 00root root 0000000 0000000 mkdocs-redirects-1.2.1/.github/workflows/ 0000775 0000000 0000000 00000000000 14455601446 0020363 5 ustar 00root root 0000000 0000000 mkdocs-redirects-1.2.1/.github/workflows/ci.yml 0000664 0000000 0000000 00000002317 14455601446 0021504 0 ustar 00root root 0000000 0000000 name: CI
on:
push:
pull_request:
schedule:
- cron: '0 6 * * 6'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- python: '^3.10'
os: ubuntu-latest
- python: 3.9
os: windows-latest
- python: 3.8
os: ubuntu-latest
- python: 3.7
os: macos-latest
- python: 3.6
os: windows-latest
- python: 3.6
os: ubuntu-20.04
versions: minimal
runs-on: ${{matrix.os}}
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python}}
- name: Pin to lowest versions
if: matrix.versions == 'minimal'
run: |
sed -i -E "s/^ +'(\\w+)>=([0-9])/'\\1==\\2/" setup.py
- name: Install packages
run: |
python -m pip install -U pip'>=19'
pip install -U --upgrade-strategy=eager .[test]
- name: Test
run: |
.tools/ci.sh with_groups
- name: Check formatting
if: matrix.versions == null
run: |
git diff --exit-code
mkdocs-redirects-1.2.1/.gitignore 0000664 0000000 0000000 00000002263 14455601446 0016761 0 ustar 00root root 0000000 0000000 # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
mkdocs-redirects-1.2.1/.tools/ 0000775 0000000 0000000 00000000000 14455601446 0016204 5 ustar 00root root 0000000 0000000 mkdocs-redirects-1.2.1/.tools/ci.sh 0000775 0000000 0000000 00000000516 14455601446 0017140 0 ustar 00root root 0000000 0000000 #!/bin/sh
set -e
cd "$(dirname "$0")/.."
with_groups() {
echo "::group::$@"
"$@" && echo "::endgroup::"
}
srcs='mkdocs_redirects tests setup.py'
"$@" pytest -q
"$@" autoflake -i -r --remove-all-unused-imports --remove-unused-variables $srcs
"$@" isort -q $srcs
"$@" black -l100 -tpy36 --skip-string-normalization -q $srcs
mkdocs-redirects-1.2.1/LICENSE 0000664 0000000 0000000 00000002057 14455601446 0015777 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2019-2022 DataRobot
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
mkdocs-redirects-1.2.1/Makefile 0000664 0000000 0000000 00000000764 14455601446 0016435 0 ustar 00root root 0000000 0000000 clean: ## Clean intermediate build files
find . -name '__pycache__' | xargs rm -rf
find . -name '*.pyc' | xargs rm -rf
rm -rf dist/
.PHONY: clean
build: clean dev ## Build the package (source distribution)
python setup.py sdist
.PHONY: build
dev: clean ## Setup development environment
pip install .[dev]
.PHONY: dev
test: dev ## Run tests
.tools/ci.sh
.PHONY: test
release: build ## Release to PyPi
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: release
mkdocs-redirects-1.2.1/README.md 0000664 0000000 0000000 00000006251 14455601446 0016251 0 ustar 00root root 0000000 0000000 # mkdocs-redirects
Plugin for [`mkdocs`](https://www.mkdocs.org/) to create page redirects (e.g. for moved/renamed pages).
Initially developed by [DataRobot](https://www.datarobot.com/).
## Installing
> **Note:** This package requires MkDocs version 1.0.4 or higher.
Install with pip:
```bash
pip install mkdocs-redirects
```
## Using
To use this plugin, specify your desired redirects in the plugin's `redirect_maps` setting in your `mkdocs.yml`:
```yaml
plugins:
- redirects:
redirect_maps:
'old.md': 'new.md'
'old/file.md': 'new/file.md'
'some_file.md': 'http://external.url.com/foobar'
```
_Note: don't forget that specifying the `plugins` setting will override the defaults if you didn't already have it set! See [this page](https://www.mkdocs.org/user-guide/configuration/#plugins) for more information._
The redirects map should take the form of a key/value pair:
- The key of each redirect is the original _markdown doc_ (relative to the `docs_dir` path).
- This plugin will handle the filename resolution during the `mkdocs build` process.
This should be set to what the original markdown doc's filename was (or what it _would be_ if it existed), not the final HTML file rendered by MkDocs
- The value is the _redirect target_. This can take the following forms:
- Path of the _markdown doc_ you wish to be redirected to (relative to `docs_dir`)
- This plugin will handle the filename resolution during the `mkdocs build` process.
This should be set to what the markdown doc's filename is, not the final HTML file rendered by MkDocs
- External URL (e.g. `http://example.com`)
During the `mkdocs build` process, this plugin will create `.html` files in `site_dir` for each of the "old" file that redirects to the "new" path.
It will produce a warning if any problems are encountered or of the redirect target doesn't actually exist (useful if you have `strict: true` set).
### `use_directory_urls`
If you have `use_directory_urls: true` set (which is the default), this plugin will modify the redirect targets to the _directory_ URL, not the _actual_ `index.html` filename.
However, it will create the `index.html` file for each target in the correct place so URL resolution works.
For example, a redirect map of `'old/dir/README.md': 'new/dir/README.md'` will result in an HTML file created at `$site_dir/old/dir/index.html` which redirects to `../../new/dir/`.
Additionally, a redirect map of `'old/dir/doc_name.md': 'new/dir/doc_name.md'` will result in `$site_dir/old/dir/doc_name/index.html` redirecting to `../../new/dir/doc_name/`.
This mimics the behavior of how MkDocs builds the site dir without this plugin.
## Developing
### Setup a virtualenv
Create a virtualenv using a method of your choice.
```bash
brew install pyenv pyenv-virtualenv
pyenv install 2.7.18
pyenv virtualenv 2.7.18 mkdocs-redirects
pyenv activate mkdocs-redirects
```
### Build
```bash
make build
```
### Test
```bash
make test
```
## Releasing
```bash
make release
```
It will prompt you for your PyPI user and password.
See:
-