Skip to content

Commit a64f7b2

Browse files
authored
Merge branch 'mkdocs:master' into map_file
2 parents 1c843fc + d0e3d52 commit a64f7b2

File tree

13 files changed

+106
-152
lines changed

13 files changed

+106
-152
lines changed

.github/workflows/autofix.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Auto-fix
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
style:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Download source
10+
uses: actions/checkout@v4
11+
- name: Install Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: '3.12'
15+
- name: Install Hatch
16+
run: |
17+
pip install hatch
18+
- name: Install dependencies
19+
run: |
20+
hatch run style:pip freeze
21+
- name: Fix code style
22+
run: |
23+
hatch run style:fix --fix-only
24+
- name: Check if any edits are necessary
25+
run: |
26+
git diff --color --exit-code
27+
- name: Apply automatic fixes using pre-commit-ci-lite
28+
if: failure() && github.event_name == 'pull_request'
29+
uses: pre-commit-ci/lite-action@v1.0.1

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ jobs:
2323
os: ubuntu-latest
2424
- python: '3.9'
2525
os: macos-latest
26-
- python: '3.8'
26+
- python: '3.9'
2727
os: windows-latest
28-
- python: '3.8'
28+
- python: '3.9'
2929
os: ubuntu-latest
3030
versions: minimal
3131
runs-on: ${{matrix.os}}
3232
steps:
3333
- name: Download source
3434
uses: actions/checkout@v4
3535
- name: Install Python
36-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{matrix.python}}
3939
- name: Pin to lowest versions
@@ -55,7 +55,7 @@ jobs:
5555
- name: Download source
5656
uses: actions/checkout@v4
5757
- name: Install Python
58-
uses: actions/setup-python@v4
58+
uses: actions/setup-python@v5
5959
with:
6060
python-version: '3.12'
6161
- name: Install Hatch
@@ -68,11 +68,7 @@ jobs:
6868
- name: Check style
6969
if: always()
7070
run: |
71-
hatch run style:fix
72-
- name: Check formatting
73-
if: always()
74-
run: |
75-
git diff --color --exit-code
71+
hatch run style:check
7672
- name: Check types
7773
if: always()
7874
run: |

.github/workflows/deploy-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
- name: Setup Python
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.12'
1717
- name: Install dependencies

.gitignore

Lines changed: 7 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,9 @@
1-
# Byte-compiled / optimized / DLL files
1+
/dist/
2+
site*/
3+
.mypy_cache/
4+
.pytest_cache/
25
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
236
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
MANIFEST
27-
28-
# PyInstaller
29-
# Usually these files are written by a python script from a template
30-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31-
*.manifest
32-
*.spec
33-
34-
# Installer logs
35-
pip-log.txt
36-
pip-delete-this-directory.txt
37-
38-
# Unit test / coverage reports
39-
htmlcov/
40-
.tox/
41-
.coverage
42-
.coverage.*
43-
.cache
44-
nosetests.xml
45-
coverage.xml
46-
*.cover
47-
.hypothesis/
48-
.pytest_cache/
49-
50-
# Translations
51-
*.mo
52-
*.pot
53-
54-
# Django stuff:
55-
*.log
56-
local_settings.py
57-
db.sqlite3
58-
59-
# Flask stuff:
60-
instance/
61-
.webassets-cache
62-
63-
# Scrapy stuff:
64-
.scrapy
65-
66-
# Sphinx documentation
67-
docs/_build/
68-
69-
# PyBuilder
70-
target/
71-
72-
# Jupyter Notebook
73-
.ipynb_checkpoints
74-
75-
# pyenv
76-
.python-version
77-
78-
# celery beat schedule file
79-
celerybeat-schedule
80-
81-
# SageMath parsed files
82-
*.sage.py
83-
84-
# Environments
85-
.env
86-
.venv
87-
env/
88-
venv/
89-
ENV/
90-
env.bak/
91-
venv.bak/
92-
93-
# Spyder project settings
94-
.spyderproject
95-
.spyproject
96-
97-
# Rope project settings
98-
.ropeproject
99-
100-
# mkdocs documentation
101-
/site
102-
103-
# mypy
104-
.mypy_cache/
7+
.venv/
8+
poetry.lock
9+
.vscode/

.tools/copier-answers.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
_commit: 0903da199
2+
_src_path: gh:oprypin/py-project-template
3+
copyright_date: '2019'
4+
mkdocs: false
5+
mkdocs_install_self: false
6+
project_description: A MkDocs plugin for dynamic page redirects to prevent broken links
7+
project_name: mkdocs-redirects
8+
pytest: true
9+
python_distribution_name: mkdocs-redirects
10+
python_source_path: mkdocs_redirects
11+
repository_name: mkdocs/mkdocs-redirects
12+
script_test: false
13+

.tools/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git diff --quiet HEAD pyproject.toml
88
rm -rf dist
99
hatch version "$1"
1010
hatch build
11-
git add */__init__.py
11+
git add mkdocs_redirects/__init__.py
1212
git commit -m "v$1"
1313
git tag -a -m "" "v$1"
1414
git push origin master --tags
File renamed without changes.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# mkdocs-redirects
22

3-
Plugin for [`mkdocs`](https://www.mkdocs.org/) to create page redirects (e.g. for moved/renamed pages).
3+
**Plugin for [`mkdocs`](https://www.mkdocs.org/) to create page redirects (e.g. for moved/renamed pages)**
44

55
Initially developed by [DataRobot](https://www.datarobot.com/).
66

7+
[![PyPI](https://img.shields.io/pypi/v/mkdocs-redirects)](https://pypi.org/project/mkdocs-redirects/)
8+
[![License](https://img.shields.io/github/license/mkdocs/mkdocs-redirects)](https://github.com/mkdocs/mkdocs-redirects/blob/master/LICENSE.md)
9+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mkdocs/mkdocs-redirects/ci.yml.svg)](https://github.com/mkdocs/mkdocs-redirects/actions?query=event%3Apush+branch%3Amaster)
10+
711
## Installing
812

913
Install with pip:

mkdocs_redirects/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.1"
1+
__version__ = "1.2.2"

mkdocs_redirects/plugin.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
<meta charset="utf-8">
2222
<title>Redirecting...</title>
2323
<link rel="canonical" href="{url}">
24-
<meta name="robots" content="noindex">
2524
<script>var anchor=window.location.hash.substr(1);location.href="{url}"+(anchor?"#"+anchor:"")</script>
2625
<meta http-equiv="refresh" content="0; url={url}">
2726
</head>
2827
<body>
29-
Redirecting...
28+
You're being redirected to a <a href="{url}">new destination</a>.
3029
</body>
3130
</html>
3231
"""
@@ -91,7 +90,7 @@ def on_files(self, files, config, **kwargs):
9190
self.redirects = self.config.get('redirect_maps', {})
9291

9392
# Validate user-provided redirect "old files"
94-
for page_old in self.redirects.keys():
93+
for page_old in self.redirects:
9594
if not utils.is_markdown_file(page_old):
9695
log.warning("redirects plugin: '%s' is not a valid markdown file!", page_old)
9796

0 commit comments

Comments
 (0)