Skip to content

Commit

Permalink
🎨 style: fix whitespace issues
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo committed Oct 7, 2023
1 parent 8aabeae commit 5458b1c
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ function generate_and_commit_card {
echo "Failed to update social media card for $file"
exit 1
}

git add "$social_media_card" || {
echo "Failed to add social media card $social_media_card"
exit 1
}

git add "$file" || {
echo "Failed to add $file"
exit 1
Expand All @@ -103,21 +103,21 @@ function is_minified() {
echo "Either terser or uglifyjs is not installed. Skipping minification check."
return 0
fi

# Original file size.
local original_size=$(wc -c < "$file")

# File size after compression with terser.
local terser_size=$(terser --compress --mangle -- "$file" | wc -c)

# File size after compression with uglifyjs.
local uglifyjs_size=$(uglifyjs --compress --mangle -- "$file" | wc -c)

# Check if the file is already as small as or smaller than both minified versions.
if (( original_size <= terser_size && original_size <= uglifyjs_size )); then
return 0
fi

# 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
error_exit "Minified JS file $file isn't as small as it can be! Try using terser for better compression."
Expand Down
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ default_theme = "light"
# All other skins have optimal contrast.
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.
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
browser_theme_color = "#087e96"
Expand Down
4 changes: 2 additions & 2 deletions sass/parts/_header-anchor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
width: 1.9rem;
height: 100%;
user-select: none;

@media (max-width: 500px) {
display: none;
}
Expand All @@ -28,7 +28,7 @@ h1, h2, h3, h4, h5, h6 {
&:hover .header-anchor {
opacity: 1;
}

.header-anchor:hover {
background-color: transparent;
}
Expand Down
4 changes: 2 additions & 2 deletions static/js/decodeMail.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
// See https://en.wikipedia.org/wiki/Email_address#Internationalization
// Code below adapted from Jackie Han: https://stackoverflow.com/a/64752311
const byteString = atob(encodedString);

// Convert byteString to an array of char codes.
const charCodes = [...byteString].map(char => char.charCodeAt(0));

// Use TypedArray.prototype.set() to copy the char codes into a Uint8Array.
const bytes = new Uint8Array(charCodes.length);
bytes.set(charCodes);
Expand Down
2 changes: 1 addition & 1 deletion static/js/isso.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function loadIsso(commentsDiv) {
script.setAttribute('data-isso-vote', voting);
script.setAttribute('data-isso-page-author-hashes', hashes);
script.setAttribute('data-isso-css', 'false');

// Set the id and data-isso-id of the Isso thread.
const section = document.createElement('section');
section.id = 'isso-thread';
Expand Down
2 changes: 1 addition & 1 deletion static/js/utterances.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function setUtterancesTheme(newTheme) {
// Get the frame with class "utterances-frame".
const frame = document.querySelector(".utterances-frame");

if (frame) {
// If the iframe exists, send a message to set the theme.
frame.contentWindow.postMessage(
Expand Down
2 changes: 1 addition & 1 deletion templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
&nbsp;{{ 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 %}.
{%- 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 %}/">
{{ 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 %}
Expand Down
2 changes: 1 addition & 1 deletion templates/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{%- set section_item = get_section(path=section_path ~ "_index.md") %}
{%- else %}
{%- set section_item = get_section(path=section_path ~ "_index." ~ lang ~ ".md") %}
{%- endif %}
{%- endif %}

{% for year, posts in
section_item.pages | group_by(attribute="year") %} {% if posts | length > 0
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% import "macros/table_of_contents.html" as macros_toc %}
{% 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.
This variable will hold all the text strings for the language #}
{%- set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%}
Expand Down
2 changes: 1 addition & 1 deletion templates/macros/format_date.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% endif %}

{# Return the date. #}
{{ date | date(format="%-d") }}{{ suffix }}
{{ date | date(format="%-d") }}{{ suffix }}
{% if short == true %}
{{ date | date(format="%b %Y") }}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h3>TL;DR:</h3>

{# 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" %}
{{ macros_toc::toc(page=page, header=true, language_strings=language_strings) }}
{{ macros_toc::toc(page=page, header=true, language_strings=language_strings) }}
{% endif %}

<section class="body">
Expand Down
14 changes: 7 additions & 7 deletions templates/partials/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@
data-goatcounter="{{ self_hosted_url ~ '/count' }}"
src="{{ self_hosted_url ~ '/count.js' }}"
{% else %}
data-goatcounter="https://{{ analytics_id }}.goatcounter.com/count"
data-goatcounter="https://{{ analytics_id }}.goatcounter.com/count"
src="https://gc.zgo.at/count.js"
{% endif %}
></script>

{% elif analytics_service == "umami" %}
<script async defer
<script async defer
{% if self_hosted_url %}
data-website-id="{{ analytics_id }}"
data-website-id="{{ analytics_id }}"
src="{{ self_hosted_url ~ '/umami.js' }}"
{% else %}
data-website-id="{{ analytics_id }}"
data-website-id="{{ analytics_id }}"
src="https://analytics.eu.umami.is/script.js"
{% endif %}
data-do-not-track="true">
</script>

{% elif analytics_service == "plausible" %}
<script
defer
data-domain="{{ analytics_id }}"
<script
defer
data-domain="{{ analytics_id }}"
src="{% if self_hosted_url %}{{ self_hosted_url ~ '/js/plausible.js' }}{% else %}https://plausible.io/js/script.js{% endif %}"
></script>

Expand Down
2 changes: 1 addition & 1 deletion templates/partials/cards_pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{%- endif -%}

{% set target_url = page.extra.link_to | default(value=page.permalink) %}

<a rel="{{ rel_attributes }}" {{ blank_target }} href="{{ target_url }}">
{% if page.extra.local_image %}
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
Expand Down
14 changes: 7 additions & 7 deletions templates/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{# Feed #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path="atom.xml",
trailing_slash=false) }}">

{# CSS #}
{# Load subset of glyphs for header. Avoids flashing issue in Firefox #}
{% if config.extra.custom_subset and config.extra.custom_subset == true %}
Expand Down Expand Up @@ -49,7 +49,7 @@
{%- for stylesheet in stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) | safe }}" />
{%- 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 -%}" />

{%- if config.extra.browser_theme_color and config.extra.browser_theme_color is iterable -%}
Expand Down Expand Up @@ -90,10 +90,10 @@
{# Try to construct the image path relative to the current page #}
{% set colocated_path = page.colocated_path | default(value="") %}
{% set file_path = colocated_path ~ social_media_card %}

{# Fetch metadata to verify image existence at the relative path #}
{%- set meta = get_image_metadata(path=file_path, allow_missing=true) -%}

{# Check if relative path exists, else try absolute path #}
{% if meta %}
{% set final_path = file_path %}
Expand All @@ -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.") }}
{% endif %}
{% endif %}

{# Generate the social media meta tags #}
<meta property="og:image" content="{{ get_url(path=final_path, cachebust=true) }}" />
<meta property="og:image:width" content="{{ meta.width }}" />
Expand All @@ -131,15 +131,15 @@
{%- set canonical_url = current_url | replace(from=config.base_url, to=config.extra.base_canonical_url) -%}
{%- endif -%}
{%- endif -%}

{# Add canonical URL, if set #}
{%- if canonical_url -%}
<link rel="canonical" href="{{ canonical_url }}" />
<meta property="og:url" content="{{ canonical_url }}" />
{%- elif current_url -%}
<meta property="og:url" content="{{ current_url }}" />
{%- endif -%}

<meta property="og:site_name" content="{{ config.title }}">

{%- include "partials/content_security_policy.html" -%}
Expand Down
2 changes: 1 addition & 1 deletion templates/shortcodes/multilingual_quote.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<p>{{ open_quote ~ original ~ close_quote }}</p>
{% 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) -}})
</label></p>
</label></p>
</blockquote>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ default_theme = "light"
# All other skins have optimal contrast.
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.
# More details: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
# browser_theme_color = "#087e96" # Example of single value.
Expand Down

0 comments on commit 5458b1c

Please sign in to comment.