From 7d8ed20c2437ca285cc748359c4b2ff500a3968c Mon Sep 17 00:00:00 2001 From: welpo Date: Mon, 28 Aug 2023 18:24:40 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(HTML):=20use=20wh?= =?UTF-8?q?itespace=20control?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improves the cleanliness of the HTML related to the comment systems. --- templates/macros/create_history_url.html | 34 ++++++++++++------------ templates/partials/header.html | 6 ++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/templates/macros/create_history_url.html b/templates/macros/create_history_url.html index 74a34cc..dd59f7d 100644 --- a/templates/macros/create_history_url.html +++ b/templates/macros/create_history_url.html @@ -1,29 +1,29 @@ {% macro create_history_url(relative_path) %} -{% set repository_url = config.extra.remote_repository_url | trim_end_matches(pat='/') %} -{% set branch = config.extra.remote_repository_branch | default(value="main") %} -{% set git_platform = config.extra.remote_repository_git_platform | default(value="auto") %} +{%- set repository_url = config.extra.remote_repository_url | trim_end_matches(pat='/') -%} +{%- set branch = config.extra.remote_repository_branch | default(value="main") -%} +{%- set git_platform = config.extra.remote_repository_git_platform | default(value="auto") -%} {# Auto-detect the git platform based on the URL#} -{% if git_platform == "auto" %} - {% if repository_url is containing("github.") %} - {% set git_platform = "github" %} - {% elif repository_url is containing("gitlab.") %} - {% set git_platform = "gitlab" %} - {% elif repository_url is matching("(gitea\.|codeberg\.)") %} - {% set git_platform = "gitea" %} - {% endif %} -{% endif %} +{%- if git_platform == "auto" %} + {%- if repository_url is containing("github.") -%} + {%- set git_platform = "github" -%} + {%- elif repository_url is containing("gitlab.") -%} + {%- set git_platform = "gitlab" -%} + {%- elif repository_url is matching("(gitea\.|codeberg\.)") -%} + {%- set git_platform = "gitea" -%} + {%- endif -%} +{%- endif -%} {# Generate the commit history URL based on the git platform #} -{% if git_platform == "github" %} +{%- if git_platform == "github" -%} {{ repository_url ~ '/commits/' ~ branch ~ '/content/' }}{{ relative_path | urlencode }} -{% elif git_platform == "gitlab" %} +{%- elif git_platform == "gitlab" -%} {{ repository_url ~ '/-/commits/' ~ branch ~ '/' }}{{ relative_path | urlencode }} -{% elif git_platform in ["gitea", "codeberg"] %} +{%- elif git_platform in ["gitea", "codeberg"] -%} {{ repository_url ~ '/commits/branch/' ~ branch ~ '/' }}{{ relative_path | urlencode }} -{% else %} +{%- else -%} {{ throw(message="ERROR: Unknown, unsupported, or unspecified git platform. If you're using a custom domain, please specify the 'git_platform' in the config. If you think this is a bug, please report it: https://github.com/welpo/tabi/issues/new?assignees=&labels=bug&template=bug_report.md&title=Unsupported%20Git%20Platform%20Detected") }} -{% endif %} +{%- endif -%} {% endmacro %} diff --git a/templates/partials/header.html b/templates/partials/header.html index 1d7c6fe..ffa92f1 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -93,11 +93,11 @@ {%- set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk -%} {%- set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso -%} - {% if hyvortalk_enabled %} + {%- if hyvortalk_enabled -%} connect-src talk.hyvor.com; - {% elif isso_enabled %} + {%- elif isso_enabled -%} connect-src {{ config.extra.isso.endpoint_url }}; - {% endif %} + {%- endif -%} {%- for domain in config.extra.allowed_domains -%} {{ domain.directive }} {{ domain.domains | join(sep=' ') -}}