added link context

This commit is contained in:
Hazel Noack 2025-05-16 15:18:02 +02:00
parent f84fb65aa7
commit f02d37a6af
2 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## Sunt aevis
{{example.link}}
Lorem markdownum turbavere prisca Aeacidae morando esse. Quam Styga spectata,
pariter Iove iunctis exercere Solis? Atlantis possit succurrere quam!

View File

@ -130,6 +130,13 @@ class LanguageDict(dict):
LANGUAGES = LanguageDict()
def compile_cross_article_context(cross_article_context):
title = cross_article_context["title"]
url = cross_article_context["url"]
cross_article_context["link"] = f'<a href="{url}">{title}</a>'
class ArticleTranslation:
def __init__(self, file: Path, article: Article):
self.file = file
@ -163,6 +170,7 @@ class ArticleTranslation:
self.cross_article_context["title"] = self.context["title"]
self.cross_article_context["article_url"] = self.article.url
self.cross_article_context["url"] = self.url
compile_cross_article_context(self.cross_article_context)
# get children
self.context["children"] = [
@ -251,7 +259,7 @@ class Article:
self.cross_article_context.update(self.context_shared)
self.cross_article_context["title"] = self.context_shared["slug"]
self.cross_article_context["article_url"] = self.context_shared["url"]
compile_cross_article_context(self.cross_article_context)
# recursive context structures
translation_list = self.context["translations"] = []