From 03a6bd7386559a1040c63b2de78cf27379d55948 Mon Sep 17 00:00:00 2001 From: eerussianguy Date: Fri, 4 Oct 2024 14:12:49 -0400 Subject: [PATCH] experiment with link preview support --- assets/templates/default.html | 11 +++++++++-- src/main.py | 14 +++++++++++++- tfc/TerraFirmaCraft | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) create mode 160000 tfc/TerraFirmaCraft diff --git a/assets/templates/default.html b/assets/templates/default.html index dc4cebfd4c..c6522a838e 100644 --- a/assets/templates/default.html +++ b/assets/templates/default.html @@ -3,8 +3,15 @@ - - {title} + + + + + + + + + {long_title} diff --git a/src/main.py b/src/main.py index 598e803c6e..d72025d274 100644 --- a/src/main.py +++ b/src/main.py @@ -407,6 +407,9 @@ def build_book_html(context: Context): # Main Page util.write_html(context.output_dir, 'index.html', html=TEMPLATE.format( title=context.translate(I18n.TITLE), + long_title=context.translate(I18n.TITLE), + short_description=context.translate(I18n.HOME), + preview_image=get_splash_location(), text_index=context.translate(I18n.INDEX), text_contents=context.translate(I18n.CONTENTS), text_version=context.translate(I18n.VERSION), @@ -434,7 +437,7 @@ def build_book_html(context: Context): """.format( text_home=context.translate(I18n.HOME), text_entries=context.translate(I18n.CATEGORIES), - splash_image='splash' if versions.MC_VERSION != '1.20.1' else 'splash_120' + splash_image=get_splash_location() ) + '\n'.join( """
@@ -458,6 +461,9 @@ def build_book_html(context: Context): for category_id, cat in context.sorted_categories: util.write_html(context.output_dir, category_id, 'index.html', html=TEMPLATE.format( title=context.translate(I18n.TITLE), + long_title=cat.name + " | " + context.translate(I18n.TITLE), + short_description=cat.name, + preview_image=get_splash_location(), text_index=context.translate(I18n.INDEX), text_contents=context.translate(I18n.CONTENTS), text_version=context.translate(I18n.VERSION), @@ -514,6 +520,9 @@ def build_book_html(context: Context): for entry_id, entry in cat.sorted_entries: util.write_html(context.output_dir, entry_id + '.html', html=TEMPLATE.format( title=context.translate(I18n.TITLE), + long_title=entry.name + " | " + cat.name + " | " + context.translate(I18n.TITLE), + short_description=entry.name, + preview_image=entry.icon, text_index=context.translate(I18n.INDEX), text_contents=context.translate(I18n.CONTENTS), text_version=context.translate(I18n.VERSION), @@ -569,6 +578,9 @@ def title_with_optional_icon(text: str, icon_src: str, icon_title: str) -> str: else: return text +def get_splash_location(): + return 'splash' if versions.MC_VERSION != '1.20.1' else 'splash_120' + def entry_card_with_default_icon(entry_page: str, entry_title: str, icon_src: str, icon_title: str) -> str: if not icon_src: icon_src = util.path_join('..', '..', '_images', 'placeholder_16.png') diff --git a/tfc/TerraFirmaCraft b/tfc/TerraFirmaCraft new file mode 160000 index 0000000000..2506917b37 --- /dev/null +++ b/tfc/TerraFirmaCraft @@ -0,0 +1 @@ +Subproject commit 2506917b37f965a9e4f59e805a2a37962e8d28cf