adding latest

This commit is contained in:
2021-11-01 02:13:34 +00:00
parent bfc34e9414
commit f2bca8f2e1
3 changed files with 18 additions and 17 deletions

View File

@@ -43,6 +43,7 @@ class PageCreatorOptions:
class PageCreator:
@abstractmethod
def __init__(self, options: PageCreatorOptions) -> None:
raise NotImplementedError
@@ -52,7 +53,7 @@ class PageCreator:
raise NotImplementedError
@abstractmethod
def create_page(self, options: PageCreatorOptions) -> Page:
def create_page(self) -> Page:
raise NotImplementedError
def _check_base_path_exists(self) -> None:
@@ -111,16 +112,15 @@ class ScopedPageCreator(PageCreator):
extension (str): extension of file.
"""
def __init__(self) -> None:
def __init__(self, options: PageCreatorOptions) -> None:
self._all_input_tokens: list[str] = []
self._options: PageCreatorOptions
self._options = options
@property
def options(self) -> PageCreatorOptions:
return self._options
def create_page(self, options: PageCreatorOptions) -> Page:
self._options = options
def create_page(self) -> Page:
self._check_base_path_exists()
self._all_input_tokens = self._get_input_tokens()
@@ -130,7 +130,7 @@ class ScopedPageCreator(PageCreator):
path = pathlib.Path(self._substitute_tokens(str(path)))
template_contents = self._load_template()
if options.template_filename is not None:
if self.options.template_filename is not None:
template_contents = self._substitute_tokens(template_contents)
return ScopedPage(path, template_contents)