Exclude certain files from output
This commit is contained in:
parent
0305754b83
commit
a6900908b0
2 changed files with 19 additions and 0 deletions
18
hooks/exclude-static.py
Normal file
18
hooks/exclude-static.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import fnmatch
|
||||||
|
|
||||||
|
from mkdocs.plugins import event_priority, get_plugin_logger
|
||||||
|
|
||||||
|
EXCLUDED_FILES = {
|
||||||
|
"*.mmd"
|
||||||
|
}
|
||||||
|
|
||||||
|
logger = get_plugin_logger("exclude-static")
|
||||||
|
|
||||||
|
@event_priority(100)
|
||||||
|
def on_files(files, config):
|
||||||
|
for file in files:
|
||||||
|
if any(fnmatch.fnmatch(file.url, pattern) for pattern in EXCLUDED_FILES):
|
||||||
|
logger.debug("Excluding %s", file.url)
|
||||||
|
files.remove(file)
|
||||||
|
|
||||||
|
return files
|
|
@ -20,6 +20,7 @@ hooks:
|
||||||
- hooks/kroki.py
|
- hooks/kroki.py
|
||||||
- hooks/include-file.py
|
- hooks/include-file.py
|
||||||
- hooks/unsplash.py
|
- hooks/unsplash.py
|
||||||
|
- hooks/exclude-static.py
|
||||||
|
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
- attr_list
|
- attr_list
|
||||||
|
|
Loading…
Reference in a new issue