adding latest

This commit is contained in:
2021-10-24 18:28:36 +01:00
parent 0c03f32746
commit 5fb70300fb

View File

@@ -69,6 +69,9 @@ class ScopedPageCreator(PageCreator):
self.page_path = "" self.page_path = ""
self.filename = "" self.filename = ""
self.extension = "" self.extension = ""
self.path_error: MismatchedTokenError | None = None
self.template_error: MismatchedTokenError | None = None
def create_page( def create_page(
self, self,
@@ -84,8 +87,6 @@ class ScopedPageCreator(PageCreator):
self.page_path = page_path self.page_path = page_path
self.filename = filename self.filename = filename
self.extension = extension self.extension = extension
path_error: MismatchedTokenError | None = None
template_error: MismatchedTokenError | None = None
# get the path of the scoped page # get the path of the scoped page
path = self._convert_to_path( path = self._convert_to_path(
@@ -95,7 +96,7 @@ class ScopedPageCreator(PageCreator):
try: try:
path = pathlib.Path(self._substitute_tokens(str(path), user_input, name)) path = pathlib.Path(self._substitute_tokens(str(path), user_input, name))
except MismatchedTokenError as mismatched_path_error: except MismatchedTokenError as mismatched_path_error:
path_error = mismatched_path_error self.path_error = mismatched_path_error
# get the template file # get the template file
if template_filename is not None: if template_filename is not None:
# load the template file contents and substitute tokens # load the template file contents and substitute tokens
@@ -105,14 +106,14 @@ class ScopedPageCreator(PageCreator):
template_contents, user_input, name template_contents, user_input, name
) )
except MismatchedTokenError as mismatched_template_error: except MismatchedTokenError as mismatched_template_error:
template_error = mismatched_template_error self.template_error = mismatched_template_error
else: else:
template_contents = "" template_contents = ""
if path_error is not None or template_error is not None: if self.path_error is not None or self.template_error is not None:
# self.__mismatched_token_error(path_error, template_error) # self.__mismatched_token_error(path_error, template_error)
if path_error.args[0] > template_error.args[0]: if self.path_error.args[0] > self.template_error.args[0]:
print("path_token_count > template_token_count") print("path_token_count > template_token_count")
elif template_error.args[0] > path_error.args[0]: elif self.template_error.args[0] > self.path_error.args[0]:
print("template_token_count > path_token_count") print("template_token_count > path_token_count")
return ScopedPage(path, template_contents) return ScopedPage(path, template_contents)