Filter pages for assignments
Project description
File filter plugin for mkdocs
select-files is a
mkdocs plugin that filters out
files (pages) using a parametrized regular expression.
The main use case for this plugin is to prepare lectures or assignments and only publishing them at a given date.
Quick start
-
Install the module using pip:
pip3 install mkdocs-select-files -
In your project, add a plugin configuration to
mkdocs.yml:plugins: - select-files: select: '^s(\d+)' where: 'lambda x : int(x) <= 5'
This would search for files named sNN... and select only those where NN is
less than or equal to 5.
In the where expression, you can use the following declared variables
now: represent the current time in ISO formatsfc: The value of theSELECT_FILE_CONDITIONenvironment variable.
The modules os and datetime are imported, so you can use methods from them.
Disabling the plugin
You can disable the plugin using an environment variable. For example, you could configure your site this way:
plugins:
- select-files:
select: '^s(\d+)'
where: 'lambda x : int(x) <= 5'
disabled_if_env: SELECT_FILES_DISABLED
and then, running mkdocs with SELECT_FILES_DISABLED set to 1 would disable this plugin
and let all pages be processed:
SELECT_FILES_DISABLED=1 mkdocs ...
Credits
Thank you to Lucy Linder for her great idea of using parametrized regular expressions.
Similar plugins
- mkdocs-exclude : exclude arbitrary file paths and patterns from the input
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs-select-files-0.4.0.tar.gz.
File metadata
- Download URL: mkdocs-select-files-0.4.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfb08a02cd47227dc7fb26ce7cb5d586c26262a0782c93977d142184743f74c1
|
|
| MD5 |
c824725b3909c27289e5adcdc0e46b92
|
|
| BLAKE2b-256 |
7441c70ba895af7bd7066e37b31c182048faa34de9f403d10fd6bbb47163a161
|
File details
Details for the file mkdocs_select_files-0.4.0-py3-none-any.whl.
File metadata
- Download URL: mkdocs_select_files-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e2f187ab0d5d3bf79b3020e0ae633865a357462883d4667978cb6b6bce58e3a
|
|
| MD5 |
857b833df2b4c76791ddbc7363cae933
|
|
| BLAKE2b-256 |
b6d4f9a022275712b24059b11634f0b8b540727e63030d848006eeece4609345
|