docs: conf.py: properly handle include and exclude patterns
When one does:
make SPHINXDIRS="foo" htmldocs
All patterns would be relative to Documentation/foo, which
causes the include/exclude patterns like:
include_patterns = [
...
f'foo/*.{ext}',
]
to break. This is not what it is expected. Address it by
adding a logic to dynamically adjust the pattern when
SPHINXDIRS is used.
That allows adding parsers for other file types.
It should be noticed that include_patterns was added on
Sphinx 5.1:
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-include_patterns
So, a backward-compatible code is needed when we start
using it for real.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/429c9c670fe27860f5e4f29aaf72576a4ed52ad1.1750571906.git.mchehab+huawei@kernel.org