mirror of
https://github.com/dtomlinson91/tembo.git
synced 2025-12-22 11:55:45 +00:00
adding latest
This commit is contained in:
@@ -69,6 +69,9 @@ class ScopedPageCreator(PageCreator):
|
||||
self.page_path = ""
|
||||
self.filename = ""
|
||||
self.extension = ""
|
||||
self.path_error: MismatchedTokenError | None = None
|
||||
self.template_error: MismatchedTokenError | None = None
|
||||
|
||||
|
||||
def create_page(
|
||||
self,
|
||||
@@ -84,8 +87,6 @@ class ScopedPageCreator(PageCreator):
|
||||
self.page_path = page_path
|
||||
self.filename = filename
|
||||
self.extension = extension
|
||||
path_error: MismatchedTokenError | None = None
|
||||
template_error: MismatchedTokenError | None = None
|
||||
|
||||
# get the path of the scoped page
|
||||
path = self._convert_to_path(
|
||||
@@ -95,7 +96,7 @@ class ScopedPageCreator(PageCreator):
|
||||
try:
|
||||
path = pathlib.Path(self._substitute_tokens(str(path), user_input, name))
|
||||
except MismatchedTokenError as mismatched_path_error:
|
||||
path_error = mismatched_path_error
|
||||
self.path_error = mismatched_path_error
|
||||
# get the template file
|
||||
if template_filename is not None:
|
||||
# load the template file contents and substitute tokens
|
||||
@@ -105,14 +106,14 @@ class ScopedPageCreator(PageCreator):
|
||||
template_contents, user_input, name
|
||||
)
|
||||
except MismatchedTokenError as mismatched_template_error:
|
||||
template_error = mismatched_template_error
|
||||
self.template_error = mismatched_template_error
|
||||
else:
|
||||
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)
|
||||
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")
|
||||
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")
|
||||
return ScopedPage(path, template_contents)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user