🎨 style: fix whitespace issues
This commit is contained in:
parent
8aabeaecc3
commit
5458b1c533
@ -74,12 +74,12 @@ function generate_and_commit_card {
|
|||||||
echo "Failed to update social media card for $file"
|
echo "Failed to update social media card for $file"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
git add "$social_media_card" || {
|
git add "$social_media_card" || {
|
||||||
echo "Failed to add social media card $social_media_card"
|
echo "Failed to add social media card $social_media_card"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
git add "$file" || {
|
git add "$file" || {
|
||||||
echo "Failed to add $file"
|
echo "Failed to add $file"
|
||||||
exit 1
|
exit 1
|
||||||
@ -103,13 +103,13 @@ function is_minified() {
|
|||||||
echo "Either terser or uglifyjs is not installed. Skipping minification check."
|
echo "Either terser or uglifyjs is not installed. Skipping minification check."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Original file size.
|
# Original file size.
|
||||||
local original_size=$(wc -c < "$file")
|
local original_size=$(wc -c < "$file")
|
||||||
|
|
||||||
# File size after compression with terser.
|
# File size after compression with terser.
|
||||||
local terser_size=$(terser --compress --mangle -- "$file" | wc -c)
|
local terser_size=$(terser --compress --mangle -- "$file" | wc -c)
|
||||||
|
|
||||||
# File size after compression with uglifyjs.
|
# File size after compression with uglifyjs.
|
||||||
local uglifyjs_size=$(uglifyjs --compress --mangle -- "$file" | wc -c)
|
local uglifyjs_size=$(uglifyjs --compress --mangle -- "$file" | wc -c)
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ function is_minified() {
|
|||||||
if (( original_size <= terser_size && original_size <= uglifyjs_size )); then
|
if (( original_size <= terser_size && original_size <= uglifyjs_size )); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the file isn't as small as it can be, suggest the better compressor in the error message
|
# If the file isn't as small as it can be, suggest the better compressor in the error message
|
||||||
if (( terser_size < uglifyjs_size )); then
|
if (( terser_size < uglifyjs_size )); then
|
||||||
error_exit "Minified JS file $file isn't as small as it can be! Try using terser for better compression."
|
error_exit "Minified JS file $file isn't as small as it can be! Try using terser for better compression."
|
||||||
|
@ -63,7 +63,7 @@ default_theme = "light"
|
|||||||
# All other skins have optimal contrast.
|
# All other skins have optimal contrast.
|
||||||
skin = ""
|
skin = ""
|
||||||
|
|
||||||
# Set browser theme colour. Can be a single colour or [light, dark].
|
# Set browser theme colour. Can be a single colour or [light, dark].
|
||||||
# Note: Bright colors may be ignored in dark mode.
|
# Note: Bright colors may be ignored in dark mode.
|
||||||
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
||||||
browser_theme_color = "#087e96"
|
browser_theme_color = "#087e96"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
width: 1.9rem;
|
width: 1.9rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
&:hover .header-anchor {
|
&:hover .header-anchor {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-anchor:hover {
|
.header-anchor:hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
// See https://en.wikipedia.org/wiki/Email_address#Internationalization
|
// See https://en.wikipedia.org/wiki/Email_address#Internationalization
|
||||||
// Code below adapted from Jackie Han: https://stackoverflow.com/a/64752311
|
// Code below adapted from Jackie Han: https://stackoverflow.com/a/64752311
|
||||||
const byteString = atob(encodedString);
|
const byteString = atob(encodedString);
|
||||||
|
|
||||||
// Convert byteString to an array of char codes.
|
// Convert byteString to an array of char codes.
|
||||||
const charCodes = [...byteString].map(char => char.charCodeAt(0));
|
const charCodes = [...byteString].map(char => char.charCodeAt(0));
|
||||||
|
|
||||||
// Use TypedArray.prototype.set() to copy the char codes into a Uint8Array.
|
// Use TypedArray.prototype.set() to copy the char codes into a Uint8Array.
|
||||||
const bytes = new Uint8Array(charCodes.length);
|
const bytes = new Uint8Array(charCodes.length);
|
||||||
bytes.set(charCodes);
|
bytes.set(charCodes);
|
||||||
|
@ -56,7 +56,7 @@ function loadIsso(commentsDiv) {
|
|||||||
script.setAttribute('data-isso-vote', voting);
|
script.setAttribute('data-isso-vote', voting);
|
||||||
script.setAttribute('data-isso-page-author-hashes', hashes);
|
script.setAttribute('data-isso-page-author-hashes', hashes);
|
||||||
script.setAttribute('data-isso-css', 'false');
|
script.setAttribute('data-isso-css', 'false');
|
||||||
|
|
||||||
// Set the id and data-isso-id of the Isso thread.
|
// Set the id and data-isso-id of the Isso thread.
|
||||||
const section = document.createElement('section');
|
const section = document.createElement('section');
|
||||||
section.id = 'isso-thread';
|
section.id = 'isso-thread';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
function setUtterancesTheme(newTheme) {
|
function setUtterancesTheme(newTheme) {
|
||||||
// Get the frame with class "utterances-frame".
|
// Get the frame with class "utterances-frame".
|
||||||
const frame = document.querySelector(".utterances-frame");
|
const frame = document.querySelector(".utterances-frame");
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
// If the iframe exists, send a message to set the theme.
|
// If the iframe exists, send a message to set the theme.
|
||||||
frame.contentWindow.postMessage(
|
frame.contentWindow.postMessage(
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{{ macros_translate::translate(key="translation_missing", default="or hasn't been translated into your language yet", force_lang=language_name, language_strings=language_strings) }}{{ macros_translate::translate(key="full_stop", default=".", force_lang=language_name, language_strings=language_strings) }}
|
{{ macros_translate::translate(key="translation_missing", default="or hasn't been translated into your language yet", force_lang=language_name, language_strings=language_strings) }}{{ macros_translate::translate(key="full_stop", default=".", force_lang=language_name, language_strings=language_strings) }}
|
||||||
{%- else %}.
|
{%- else %}.
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{{ macros_translate::translate(key="check_url", default="Check the URL for errors or", force_lang=language_name, language_strings=language_strings) }}
|
{{ macros_translate::translate(key="check_url", default="Check the URL for errors or", force_lang=language_name, language_strings=language_strings) }}
|
||||||
<a href="{{ config.base_url }}{% if language_name != config.default_language %}/{{ language_name }}{% endif %}/">
|
<a href="{{ config.base_url }}{% if language_name != config.default_language %}/{{ language_name }}{% endif %}/">
|
||||||
{{ macros_translate::translate(key="go_home", default="go back to the homepage", force_lang=language_name, language_strings=language_strings) }}</a>{{ macros_translate::translate(key="full_stop", default=".", force_lang=language_name, language_strings=language_strings) }}</p>
|
{{ macros_translate::translate(key="go_home", default="go back to the homepage", force_lang=language_name, language_strings=language_strings) }}</a>{{ macros_translate::translate(key="full_stop", default=".", force_lang=language_name, language_strings=language_strings) }}</p>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
{%- set section_item = get_section(path=section_path ~ "_index.md") %}
|
{%- set section_item = get_section(path=section_path ~ "_index.md") %}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
{%- set section_item = get_section(path=section_path ~ "_index." ~ lang ~ ".md") %}
|
{%- set section_item = get_section(path=section_path ~ "_index." ~ lang ~ ".md") %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% for year, posts in
|
{% for year, posts in
|
||||||
section_item.pages | group_by(attribute="year") %} {% if posts | length > 0
|
section_item.pages | group_by(attribute="year") %} {% if posts | length > 0
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{% import "macros/table_of_contents.html" as macros_toc %}
|
{% import "macros/table_of_contents.html" as macros_toc %}
|
||||||
{% import "macros/translate.html" as macros_translate %}
|
{% import "macros/translate.html" as macros_translate %}
|
||||||
|
|
||||||
{# Load the internationalisation data for the current language from
|
{# Load the internationalisation data for the current language from
|
||||||
the .toml files in the user's '/i18n' folder, falling back to the theme's.
|
the .toml files in the user's '/i18n' folder, falling back to the theme's.
|
||||||
This variable will hold all the text strings for the language #}
|
This variable will hold all the text strings for the language #}
|
||||||
{%- set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%}
|
{%- set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Return the date. #}
|
{# Return the date. #}
|
||||||
{{ date | date(format="%-d") }}{{ suffix }}
|
{{ date | date(format="%-d") }}{{ suffix }}
|
||||||
{% if short == true %}
|
{% if short == true %}
|
||||||
{{ date | date(format="%b %Y") }}
|
{{ date | date(format="%b %Y") }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
{# Optional table of contents below the header #}
|
{# Optional table of contents below the header #}
|
||||||
{% if page.toc and macros_settings::evaluate_setting_priority(setting="toc", page=page, default_global_value=false) == "true" %}
|
{% if page.toc and macros_settings::evaluate_setting_priority(setting="toc", page=page, default_global_value=false) == "true" %}
|
||||||
{{ macros_toc::toc(page=page, header=true, language_strings=language_strings) }}
|
{{ macros_toc::toc(page=page, header=true, language_strings=language_strings) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<section class="body">
|
<section class="body">
|
||||||
|
@ -8,27 +8,27 @@
|
|||||||
data-goatcounter="{{ self_hosted_url ~ '/count' }}"
|
data-goatcounter="{{ self_hosted_url ~ '/count' }}"
|
||||||
src="{{ self_hosted_url ~ '/count.js' }}"
|
src="{{ self_hosted_url ~ '/count.js' }}"
|
||||||
{% else %}
|
{% else %}
|
||||||
data-goatcounter="https://{{ analytics_id }}.goatcounter.com/count"
|
data-goatcounter="https://{{ analytics_id }}.goatcounter.com/count"
|
||||||
src="https://gc.zgo.at/count.js"
|
src="https://gc.zgo.at/count.js"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
{% elif analytics_service == "umami" %}
|
{% elif analytics_service == "umami" %}
|
||||||
<script async defer
|
<script async defer
|
||||||
{% if self_hosted_url %}
|
{% if self_hosted_url %}
|
||||||
data-website-id="{{ analytics_id }}"
|
data-website-id="{{ analytics_id }}"
|
||||||
src="{{ self_hosted_url ~ '/umami.js' }}"
|
src="{{ self_hosted_url ~ '/umami.js' }}"
|
||||||
{% else %}
|
{% else %}
|
||||||
data-website-id="{{ analytics_id }}"
|
data-website-id="{{ analytics_id }}"
|
||||||
src="https://analytics.eu.umami.is/script.js"
|
src="https://analytics.eu.umami.is/script.js"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
data-do-not-track="true">
|
data-do-not-track="true">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% elif analytics_service == "plausible" %}
|
{% elif analytics_service == "plausible" %}
|
||||||
<script
|
<script
|
||||||
defer
|
defer
|
||||||
data-domain="{{ analytics_id }}"
|
data-domain="{{ analytics_id }}"
|
||||||
src="{% if self_hosted_url %}{{ self_hosted_url ~ '/js/plausible.js' }}{% else %}https://plausible.io/js/script.js{% endif %}"
|
src="{% if self_hosted_url %}{{ self_hosted_url ~ '/js/plausible.js' }}{% else %}https://plausible.io/js/script.js{% endif %}"
|
||||||
></script>
|
></script>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{% set target_url = page.extra.link_to | default(value=page.permalink) %}
|
{% set target_url = page.extra.link_to | default(value=page.permalink) %}
|
||||||
|
|
||||||
<a rel="{{ rel_attributes }}" {{ blank_target }} href="{{ target_url }}">
|
<a rel="{{ rel_attributes }}" {{ blank_target }} href="{{ target_url }}">
|
||||||
{% if page.extra.local_image %}
|
{% if page.extra.local_image %}
|
||||||
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
{# Feed #}
|
{# Feed #}
|
||||||
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path="atom.xml",
|
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path="atom.xml",
|
||||||
trailing_slash=false) }}">
|
trailing_slash=false) }}">
|
||||||
|
|
||||||
{# CSS #}
|
{# CSS #}
|
||||||
{# Load subset of glyphs for header. Avoids flashing issue in Firefox #}
|
{# Load subset of glyphs for header. Avoids flashing issue in Firefox #}
|
||||||
{% if config.extra.custom_subset and config.extra.custom_subset == true %}
|
{% if config.extra.custom_subset and config.extra.custom_subset == true %}
|
||||||
@ -49,7 +49,7 @@
|
|||||||
{%- for stylesheet in stylesheets %}
|
{%- for stylesheet in stylesheets %}
|
||||||
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) | safe }}" />
|
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) | safe }}" />
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
<meta name="color-scheme" content="{%- if config.extra.theme_switcher -%}light dark{%- elif config.extra.default_theme -%}{{config.extra.default_theme}}{%- else -%}light{%- endif -%}" />
|
<meta name="color-scheme" content="{%- if config.extra.theme_switcher -%}light dark{%- elif config.extra.default_theme -%}{{config.extra.default_theme}}{%- else -%}light{%- endif -%}" />
|
||||||
|
|
||||||
{%- if config.extra.browser_theme_color and config.extra.browser_theme_color is iterable -%}
|
{%- if config.extra.browser_theme_color and config.extra.browser_theme_color is iterable -%}
|
||||||
@ -90,10 +90,10 @@
|
|||||||
{# Try to construct the image path relative to the current page #}
|
{# Try to construct the image path relative to the current page #}
|
||||||
{% set colocated_path = page.colocated_path | default(value="") %}
|
{% set colocated_path = page.colocated_path | default(value="") %}
|
||||||
{% set file_path = colocated_path ~ social_media_card %}
|
{% set file_path = colocated_path ~ social_media_card %}
|
||||||
|
|
||||||
{# Fetch metadata to verify image existence at the relative path #}
|
{# Fetch metadata to verify image existence at the relative path #}
|
||||||
{%- set meta = get_image_metadata(path=file_path, allow_missing=true) -%}
|
{%- set meta = get_image_metadata(path=file_path, allow_missing=true) -%}
|
||||||
|
|
||||||
{# Check if relative path exists, else try absolute path #}
|
{# Check if relative path exists, else try absolute path #}
|
||||||
{% if meta %}
|
{% if meta %}
|
||||||
{% set final_path = file_path %}
|
{% set final_path = file_path %}
|
||||||
@ -107,7 +107,7 @@
|
|||||||
{{ throw(message="Could not get metadata for the specified social media card image in page " ~ page.path ~ ". Attempted relative path: '" ~ file_path ~ "' and absolute path: '" ~ social_media_card ~ "'. Ensure the file exists at one of these locations.") }}
|
{{ throw(message="Could not get metadata for the specified social media card image in page " ~ page.path ~ ". Attempted relative path: '" ~ file_path ~ "' and absolute path: '" ~ social_media_card ~ "'. Ensure the file exists at one of these locations.") }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Generate the social media meta tags #}
|
{# Generate the social media meta tags #}
|
||||||
<meta property="og:image" content="{{ get_url(path=final_path, cachebust=true) }}" />
|
<meta property="og:image" content="{{ get_url(path=final_path, cachebust=true) }}" />
|
||||||
<meta property="og:image:width" content="{{ meta.width }}" />
|
<meta property="og:image:width" content="{{ meta.width }}" />
|
||||||
@ -131,7 +131,7 @@
|
|||||||
{%- set canonical_url = current_url | replace(from=config.base_url, to=config.extra.base_canonical_url) -%}
|
{%- set canonical_url = current_url | replace(from=config.base_url, to=config.extra.base_canonical_url) -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
{# Add canonical URL, if set #}
|
{# Add canonical URL, if set #}
|
||||||
{%- if canonical_url -%}
|
{%- if canonical_url -%}
|
||||||
<link rel="canonical" href="{{ canonical_url }}" />
|
<link rel="canonical" href="{{ canonical_url }}" />
|
||||||
@ -139,7 +139,7 @@
|
|||||||
{%- elif current_url -%}
|
{%- elif current_url -%}
|
||||||
<meta property="og:url" content="{{ current_url }}" />
|
<meta property="og:url" content="{{ current_url }}" />
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
<meta property="og:site_name" content="{{ config.title }}">
|
<meta property="og:site_name" content="{{ config.title }}">
|
||||||
|
|
||||||
{%- include "partials/content_security_policy.html" -%}
|
{%- include "partials/content_security_policy.html" -%}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<p>{{ open_quote ~ original ~ close_quote }}</p>
|
<p>{{ open_quote ~ original ~ close_quote }}</p>
|
||||||
{% if author %}<p> — {{ author }}{% endif %} <label for="toggle-{{ random_id }}" class="quote-label quote-label-translate">
|
{% if author %}<p> — {{ author }}{% endif %} <label for="toggle-{{ random_id }}" class="quote-label quote-label-translate">
|
||||||
({{- macros_translate::translate(key="show_translation", default="Show translation", language_strings=language_strings) -}})
|
({{- macros_translate::translate(key="show_translation", default="Show translation", language_strings=language_strings) -}})
|
||||||
</label></p>
|
</label></p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +42,7 @@ default_theme = "light"
|
|||||||
# All other skins have optimal contrast.
|
# All other skins have optimal contrast.
|
||||||
skin = ""
|
skin = ""
|
||||||
|
|
||||||
# Set browser theme colour. Can be a single colour or [light, dark].
|
# Set browser theme colour. Can be a single colour or [light, dark].
|
||||||
# Note: Bright colors may be ignored in dark mode.
|
# Note: Bright colors may be ignored in dark mode.
|
||||||
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
||||||
# browser_theme_color = "#087e96" # Example of single value.
|
# browser_theme_color = "#087e96" # Example of single value.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user