Skip to content

Commit

Permalink
feat(template): better output with liquid v4 whitespace control
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Jul 3, 2018
1 parent be880b5 commit 9520109
Show file tree
Hide file tree
Showing 33 changed files with 358 additions and 358 deletions.
2 changes: 1 addition & 1 deletion _app/_includes/_amsf.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% comment %}
This file is deprecated since v1.1.6, please include `amsf/core` instead
{% endcomment %}
{% include amsf/core %}
{%- include amsf/core -%}
16 changes: 8 additions & 8 deletions _app/_includes/amsf/author
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% comment %}
{%- comment -%}
Page/post author meta
{% endcomment %}
{% include amsf/type type=include.type %}
{% if type.author %}
{% assign author = site.data.authors[type.author] %}
{% else %}
{% assign author = site.data.authors["default"] %}
{% endif %}
{%- endcomment -%}
{%- include amsf/type type=include.type -%}
{%- if type.author -%}
{%- assign author = site.data.authors[type.author] -%}
{%- else -%}
{%- assign author = site.data.authors["default"] -%}
{%- endif -%}
34 changes: 17 additions & 17 deletions _app/_includes/amsf/core
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% comment %}
Almace Scaffolding core helpers
{% endcomment %}
{% include amsf/type type=include.type %}
{% include amsf/author %}
{% include amsf/hostname %}
{% include amsf/title %}
{% include amsf/desc %}
{% include amsf/urls %}
{% include amsf/dates %}
{% include amsf/lang %}
{% include amsf/css %}
{% include amsf/open_graph %}
{% include amsf/theme_color %}
{% include amsf/favicons %}
{% include amsf/word_counter %}
{% include amsf/thumbnail %}
{% include amsf/heading %}
{% include amsf/service_worker %}
{% include amsf/google_analytics %}
{%- include amsf/type type=include.type -%}
{%- include amsf/author -%}
{%- include amsf/hostname -%}
{%- include amsf/title -%}
{%- include amsf/desc -%}
{%- include amsf/urls -%}
{%- include amsf/dates -%}
{%- include amsf/lang -%}
{%- include amsf/css -%}
{%- include amsf/open_graph -%}
{%- include amsf/theme_color -%}
{%- include amsf/favicons -%}
{%- include amsf/word_counter -%}
{%- include amsf/thumbnail -%}
{%- include amsf/heading -%}
{%- include amsf/service_worker -%}
{%- include amsf/google_analytics -%}
12 changes: 6 additions & 6 deletions _app/_includes/amsf/css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% comment %}
{%- comment -%}
Page custom CSS
{% endcomment %}
{% capture amsf_page_css %}
{% if page.css %}
{%- endcomment -%}
{%- capture amsf_page_css -%}
{%- if page.css -%}
<style>
{{ page.css }}
</style>
{% endif %}
{% endcapture %}
{%- endif -%}
{%- endcapture -%}
26 changes: 13 additions & 13 deletions _app/_includes/amsf/dates
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{% include amsf/type type=include.type %}
{%- include amsf/type type=include.type -%}

{% comment %}
{%- comment -%}
Page publish date
{% endcomment %}
{% capture amsf_page_pubdate %}{{ type.date }}{% endcapture %}
{%- endcomment -%}
{%- capture amsf_page_pubdate %}{{ type.date }}{% endcapture -%}

{% comment %}
{%- comment -%}
Page update date
{% endcomment %}
{% capture amsf_page_update %}
{% assign date_publish = type.date | date: "%b %-d, %Y" %}
{% assign date_update = type.last_modified_at | date: "%b %-d, %Y" %}
{%- endcomment -%}
{%- capture amsf_page_update -%}
{%- assign date_publish = type.date | date: "%b %-d, %Y" -%}
{%- assign date_update = type.last_modified_at | date: "%b %-d, %Y" -%}

{% if date_publish != date_update %}
{%- if date_publish != date_update -%}
{{ type.last_modified_at }}
{% else %}
{%- else -%}
{{ type.date }}
{% endif %}
{% endcapture %}
{%- endif -%}
{%- endcapture -%}
4 changes: 2 additions & 2 deletions _app/_includes/amsf/desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% comment %}
{%- comment -%}
Site description
{% endcomment %}
{%- endcomment -%}
{%- capture amsf_site_desc -%}
{%- if page.permalink != '/' -%}
{%- if page.desc -%}
Expand Down
36 changes: 18 additions & 18 deletions _app/_includes/amsf/favicons
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{% comment %}
{%- comment -%}
Favicons

Check `static_file` and output favicon markup

@since 1.1.0
{% endcomment %}
{% capture amsf_favicon_png %}{{ "/favicon.png" | relative_url }}{% endcapture %}
{% capture amsf_favicon_svg %}{{ "/favicon.svg?assets-inline-assets-keep" | relative_url }}{% endcapture %}
{% capture amsf_mask_icon %}{{ "/mask-icon.svg" | relative_url }}{% endcapture %}
{% capture amsf_apple_touch_icon %}{{ "/apple-touch-icon.png" | relative_url }}{% endcapture %}
{%- endcomment -%}
{%- capture amsf_favicon_png %}{{ "/favicon.png" | relative_url }}{% endcapture -%}
{%- capture amsf_favicon_svg %}{{ "/favicon.svg?assets-inline-assets-keep" | relative_url }}{% endcapture -%}
{%- capture amsf_mask_icon %}{{ "/mask-icon.svg" | relative_url }}{% endcapture -%}
{%- capture amsf_apple_touch_icon %}{{ "/apple-touch-icon.png" | relative_url }}{% endcapture -%}

{% capture amsf_favicons %}
{% for static_file in site.static_files %}
{% if static_file.path == "/favicon.png" %}
{%- capture amsf_favicons -%}
{%- for static_file in site.static_files -%}
{%- if static_file.path == "/favicon.png" -%}
<link rel="icon" href="{{ amsf_favicon_png }}" type="image/png">
{% endif %}
{%- endif -%}

{% if static_file.path == "/favicon.svg" %}
{%- if static_file.path == "/favicon.svg" -%}
<link rel="icon" href="{{ amsf_favicon_svg }}" sizes="any" type="image/svg+xml">
{% endif %}
{%- endif -%}

{% if static_file.path == "/mask-icon.svg" %}
{%- if static_file.path == "/mask-icon.svg" -%}
<link rel="mask-icon" href="{{ amsf_mask_icon }}" color="{{ amsf_page_theme_color_with_fallback | strip }}">
{% endif %}
{%- endif -%}

{% if static_file.path == "/apple-touch-icon.png" %}
{%- if static_file.path == "/apple-touch-icon.png" -%}
<link rel="apple-touch-icon" href="{{ amsf_apple_touch_icon }}">
{% endif %}
{% endfor %}
{% endcapture %}
{%- endif -%}
{%- endfor -%}
{%- endcapture -%}
12 changes: 6 additions & 6 deletions _app/_includes/amsf/google_analytics
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% comment %}
{%- comment -%}
Google Analytics tracking code
{% endcomment %}
{% capture amsf_google_analytics %}
{% if site.google_analytics.enabled %}
{%- endcomment -%}
{%- capture amsf_google_analytics -%}
{%- if site.google_analytics.enabled -%}
<script async src="{{ site.google_analytics.url }}?id={{ site.google_analytics.id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics.id }}');
</script>
{% endif %}
{% endcapture %}
{%- endif -%}
{%- endcapture -%}
10 changes: 5 additions & 5 deletions _app/_includes/amsf/has_protocol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% comment %}
{%- comment -%}
Has Protocol

Check if given string has protocol (aka. external link)

{% include amsf/has_protocol url=my_url %}
{%- include amsf/has_protocol url=my_url -%}
{{ amsf_has_protocol }}

@since 1.1.6
{% endcomment %}
{% assign url = include.url | default: '' %}
{% assign amsf_has_protocol = url | match_regex: '^((?:https?:)?\/\/)' %}
{%- endcomment -%}
{%- assign url = include.url | default: '' -%}
{%- assign amsf_has_protocol = url | match_regex: '^((?:https?:)?\/\/)' -%}
Loading

0 comments on commit 9520109

Please sign in to comment.