Skip to content

Commit 397790b

Browse files
committed
Extend config scheme with templates_path
1 parent de32f62 commit 397790b

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

neoteroi/mkdocs/oad/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import re
1313
from pathlib import Path
14+
from typing import Optional
1415

1516
from mkdocs.config.config_options import Type
1617
from mkdocs.plugins import BasePlugin
@@ -19,21 +20,30 @@
1920

2021

2122
class MkDocsOpenAPIDocumentationPlugin(BasePlugin):
22-
config_scheme = (("use_pymdownx", Type(bool, default=False)),)
23+
config_scheme = (
24+
("use_pymdownx", Type(bool, default=False)),
25+
("templates_path", Type(str, default=None)),
26+
)
2327

2428
rx = re.compile(r"\[OAD\(([^\)]+)\)\]")
2529

2630
def _get_style(self) -> str:
2731
return "MKDOCS" if self.config.get("use_pymdownx", False) else "MARKDOWN"
2832

33+
def _get_templates_path(self) -> Optional[str]:
34+
return self.config.get("templates_path", None)
35+
2936
def _replacer(self, cwd):
3037
def replace(match) -> str:
3138
source = match.group(1).strip("'\"")
3239

3340
data = read_from_source(source, cwd)
3441

3542
handler = OpenAPIV3DocumentationHandler(
36-
data, style=self._get_style(), source=source
43+
data,
44+
style=self._get_style(),
45+
source=source,
46+
templates_path=self._get_templates_path(),
3747
)
3848
return handler.write()
3949

0 commit comments

Comments
 (0)