feat: properly recursively building context
This commit is contained in:
parent
6ed94db8cf
commit
1fae03e70b
@ -188,15 +188,6 @@ class Article:
|
||||
self.translation_cards = "\n".join(a.get_translation_card() for a in self.article_translations_list)
|
||||
self.article_cards = "\n".join(c.get_article_card() for c in self.child_articles)
|
||||
|
||||
for at in self.article_translations_list:
|
||||
at.__init_context__()
|
||||
self.__init_context__()
|
||||
|
||||
import json
|
||||
print(json.dumps(self.context, indent=4))
|
||||
|
||||
|
||||
|
||||
def __init_context__(self):
|
||||
self.context["url"] = self.url
|
||||
self.context_meta["slug"] = self.slug
|
||||
@ -211,6 +202,13 @@ class Article:
|
||||
self.context[article_translation.real_language_code] = article_translation.context
|
||||
translation_list.append(article_translation.context)
|
||||
|
||||
for at in self.article_translations_list:
|
||||
at.__init_context__()
|
||||
for a in self.child_articles:
|
||||
a.__init_context__()
|
||||
|
||||
import json
|
||||
print(json.dumps(self.context, indent=4))
|
||||
|
||||
|
||||
def build(self):
|
||||
@ -264,8 +262,10 @@ def build():
|
||||
logger.info("copying static folder...")
|
||||
shutil.copytree(Path(config.setup.source_directory, "static"), Path(config.setup.dist_directory, "static"), dirs_exist_ok=True)
|
||||
|
||||
logger.info("reading page tree...")
|
||||
logger.info("building page tree...")
|
||||
tree = Article(directory=Path(config.setup.source_directory, "articles"), is_root=True)
|
||||
logger.info("compiling tree context...")
|
||||
tree.__init_context__()
|
||||
|
||||
# build article reverence values
|
||||
for article_overview in ARTICLE_LAKE.values():
|
||||
|
Loading…
x
Reference in New Issue
Block a user