Skip to content

Commit

Permalink
Feat: Microformats2 in RSS and improved date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperDramsch committed Oct 30, 2024
1 parent 065f041 commit e5e916e
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 177 deletions.
3 changes: 3 additions & 0 deletions _i18n/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ series:
last: 'Letztes Jahr in'
next: 'Nächstes Jahr in'
times:
tba: "Wird bekannt gegeben"
from: "Ab"
until: "Bis"
normal:
days: 'Tage'
hours: 'Stunden'
Expand Down
96 changes: 46 additions & 50 deletions _i18n/de/dates/pretty_dates.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}
{%- if start_date == end_date -%}
{%- comment -%}When start and end dates are the same{%- endcomment -%}
{% assign day = start_date | date: "%-d" -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{%- capture pretty_date -%}
{{- day -}}. {{- month -}} {{- year -}}
{%- endcapture -%}
{%- elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" -%}
{%- comment -%}When start and end dates are in the same month{%- endcomment -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{- start_day -}}. – {{- end_day -}}. {{- month -}} {{- year -}}
{%- endcapture -%}
{%- elsif start_date | date: "%Y" == end_date | date: "%Y" -%}
{%- comment -%}When start and end dates are in the same year{%- endcomment -%}
{% assign start_day = start_date | date: "%-d" -%}
{% if include.start == nil and include.end == nil -%}
{% capture pretty_date %}{% t "times.tba" %}{% endcapture -%}
{% elsif include.start == nil -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{%- capture end_month -%}
{%- t "times.months.{{- end_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{- start_day -}}. {{- start_month -}} – {{- end_day -}}. {{- end_month -}} {{- year -}}
{%- endcapture -%}
{%- else -%}
{%- comment -%}When start and end dates are in different years{%- endcomment -%}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign end_year = end_date | date: "%Y" -%}
{% capture pretty_date %}{% t "times.until" %} {{ end_day }}. {{ end_month }} {{ end_year }}{% endcapture -%}
{% elsif include.end == nil -%}
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{%- capture end_month -%}
{%- t "times.months.{{- end_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% assign start_year = start_date | date: "%Y" -%}
{% assign end_year = end_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{-start_day-}}. {{- start_month-}} {{- start_year -}} – {{- end_day -}}. {{- end_month -}} {{- end_year -}}
{%- endcapture -%}
{%- endif -%}{{- pretty_date | strip -}}
{% capture pretty_date %}{% t "times.from" %} {{ start_day }}. {{ start_month }} {{ start_year }}{% endcapture -%}
{% else -%}
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}

{% if start_date == end_date -%}
{% assign day = start_date | date: "%-d" -%}
{% assign year = start_date | date: "%Y" -%}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture pretty_date %}{{ day }}. {{ month }} {{ year }}{% endcapture -%}

{% elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{% capture pretty_date %}{{ start_day }}. – {{ end_day }}. {{ month }} {{ year }}{% endcapture -%}

{% elsif start_date | date: "%Y" == end_date | date: "%Y" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{% capture pretty_date %}{{ start_day }}. {{ start_month }} – {{ end_day }}. {{ end_month }} {{ year }}{% endcapture -%}

{% else -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign start_year = start_date | date: "%Y" -%}
{% assign end_year = end_date | date: "%Y" -%}
{% capture pretty_date %}{{ start_day }}. {{ start_month }} {{ start_year }} – {{ end_day }}. {{ end_month }} {{ end_year }}{% endcapture -%}
{% endif -%}
{% endif -%}{{ pretty_date | strip }}
3 changes: 3 additions & 0 deletions _i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ series:
last: 'Last year held in'
next: 'Next year held in'
times:
tba: "TBA"
from: "From"
until: "Until"
normal:
days: 'days'
hours: 'hours'
Expand Down
102 changes: 51 additions & 51 deletions _i18n/en/dates/pretty_dates.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}
{% if start_date == end_date %}
{%- comment -%}When start and end dates are the same{%- endcomment -%}
{% assign day = start_date | date: "%-d" %}
{% assign year = start_date | date: "%Y" -%}
{%- capture month -%}
{% t "times.months.{{ start_date | date: "%B" }}" %}
{%- endcapture -%}
{%- capture pretty_date -%}
{{ month }} {{ day }}, {{ year }}
{%- endcapture -%}
{% elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" %}
{%- comment -%}When start and end dates are in the same month{% endcomment %}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture month %}
{%- t "times.months.{{ start_date | date: "%B" }}" -%}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{ month }} {{ start_day }} – {{ end_day }}, {{ year }}
{%- endcapture -%}
{% elsif start_date | date: "%Y" == end_date | date: "%Y" %}
{%- comment -%}When start and end dates are in the same year{%- endcomment -%}
{% if include.start == nil and include.end == nil %}
{% capture pretty_date %}{% t "times.tba" %}{% endcapture %}
{% elsif include.start == nil %}
{% assign end_date = include.end | date: "%Y-%m-%d" %}
{% assign end_day = end_date | date: "%-d" %}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture %}
{% assign end_year = end_date | date: "%Y" %}
{% capture pretty_date %}{% t "times.until" %} {{ end_month }} {{ end_day }}, {{ end_year }}{% endcapture %}
{% elsif include.end == nil %}
{% assign start_date = include.start | date: "%Y-%m-%d" %}
{% assign start_day = start_date | date: "%-d" %}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{% t "times.months.{{ start_date | date: "%B" }}" %}
{%- endcapture -%}
{%- capture end_month -%}
{% t "times.months.{{ end_date | date: "%B" }}" %}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{ start_month }} {{ start_day }} – {{ end_month }} {{ end_day }}, {{ year }}
{%- endcapture -%}
{%- else -%}
{%- comment -%}When start and end dates are in different years{%- endcomment -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{%- t "times.months.{{ start_date | date: "%B" }}" -%}
{%- endcapture -%}
{%- capture end_month -%}
{%- t "times.months.{{ end_date | date: "%B" }}" -%}
{%- endcapture -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture %}
{% assign start_year = start_date | date: "%Y" %}
{% assign end_year = end_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{ start_month}} {{start_day}}, {{ start_year }} – {{ end_month }} {{ end_day }}, {{ end_year }}
{%- endcapture -%}
{%- endif -%}{{pretty_date | strip }}
{% capture pretty_date %}{% t "times.from" %} {{ start_month }} {{ start_day }}, {{ start_year }}{% endcapture %}
{% else %}
{% assign start_date = include.start | date: "%Y-%m-%d" %}
{% assign end_date = include.end | date: "%Y-%m-%d" %}

{% if start_date == end_date %}
{%- comment -%}When start and end dates are the same{%- endcomment -%}
{% assign day = start_date | date: "%-d" %}
{% assign year = start_date | date: "%Y" %}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture %}
{% capture pretty_date %}{{ month }} {{ day }}, {{ year }}{% endcapture %}

{% elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" %}
{%- comment -%}When start and end dates are in the same month{% endcomment %}
{% assign start_day = start_date | date: "%-d" %}
{% assign end_day = end_date | date: "%-d" %}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture %}
{% assign year = start_date | date: "%Y" %}
{% capture pretty_date %}{{ month }} {{ start_day }} – {{ end_day }}, {{ year }}{% endcapture %}

{% elsif start_date | date: "%Y" == end_date | date: "%Y" %}
{%- comment -%}When start and end dates are in the same year{%- endcomment -%}
{% assign start_day = start_date | date: "%-d" %}
{% assign end_day = end_date | date: "%-d" %}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture %}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture %}
{% assign year = start_date | date: "%Y" %}
{% capture pretty_date %}{{ start_month }} {{ start_day }} – {{ end_month }} {{ end_day }}, {{ year }}{% endcapture %}

{% else %}
{%- comment -%}When start and end dates are in different years{%- endcomment -%}
{% assign start_day = start_date | date: "%-d" %}
{% assign end_day = end_date | date: "%-d" %}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture %}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture %}
{% assign start_year = start_date | date: "%Y" %}
{% assign end_year = end_date | date: "%Y" %}
{% capture pretty_date %}{{ start_month}} {{start_day}}, {{ start_year }} – {{ end_month }} {{ end_day }}, {{ end_year }}{% endcapture %}
{% endif %}
{% endif %}{{pretty_date | strip }}
3 changes: 3 additions & 0 deletions _i18n/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ series:
last: 'Ùltimo año en'
next: 'Próximo año en'
times:
tba: "Por anunciar"
from: "Desde"
until: "Hasta"
normal:
days: 'dias'
hours: 'horas'
Expand Down
96 changes: 46 additions & 50 deletions _i18n/es/dates/pretty_dates.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}
{%- if start_date == end_date -%}
{%- comment -%} When start and end dates are the same {%- endcomment -%}
{% assign day = start_date | date: "%-d" %}
{% assign year = start_date | date: "%Y" -%}
{%- capture month -%}
{%- t "times.months.{{ start_date | date: "%B" }}" -%}
{%- endcapture -%}
{%- capture pretty_date -%}
{{- day -}} de {{- month -}} de {{- year -}}
{%- endcapture -%}
{%- elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" -%}
{%- comment -%} When start and end dates are in the same month {% endcomment %}
{% assign start_day = start_date | date: "%-d" -%}
{% if include.start == nil and include.end == nil -%}
{% capture pretty_date %}{% t "times.tba" %}{% endcapture -%}
{% elsif include.start == nil -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{- start_day -}} – {{- end_day -}} de {{- month -}} de {{- year -}}
{%- endcapture -%}
{%- elsif start_date | date: "%Y" == end_date | date: "%Y" -%}
{%- comment -%} When start and end dates are in the same year {% endcomment %}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign end_year = end_date | date: "%Y" -%}
{% capture pretty_date %}{% t "times.until" %} el {{ end_day }} de {{ end_month }} de {{ end_year }}{% endcapture -%}
{% elsif include.end == nil -%}
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{%- t "times.months.{{- start_date | date: "%B" -}}" -%}
{%- endcapture -%}
{%- capture end_month -%}
{%- t "times.months.{{- end_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{- start_day -}} de {{- start_month -}} – {{- end_day -}} de {{- end_month -}} de {{- year -}}
{%- endcapture -%}
{%- else -%}
{%- comment -%} When start and end dates are in different years {%- endcomment -%}
{% assign start_day = start_date | date: "%-d" %}
{% assign end_day = end_date | date: "%-d" -%}
{%- capture start_month -%}
{%- t "times.months.{{ start_date | date: "%B" }}" -%}
{%- endcapture -%}
{%- capture end_month -%}
{%- t "times.months.{{- end_date | date: "%B" -}}" -%}
{%- endcapture -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% assign start_year = start_date | date: "%Y" -%}
{% assign end_year = end_date | date: "%Y" -%}
{%- capture pretty_date -%}
{{-start_day-}} de {{- start_month-}} de {{- start_year -}} – {{- end_day -}} de {{- end_month -}} de {{ end_year }}
{%- endcapture -%}
{%- endif -%}{{- pretty_date | strip -}}
{% capture pretty_date %}{% t "times.from" %} el {{ start_day }} de {{ start_month }} de {{ start_year }}{% endcapture -%}
{% else -%}
{% assign start_date = include.start | date: "%Y-%m-%d" -%}
{% assign end_date = include.end | date: "%Y-%m-%d" -%}

{% if start_date == end_date -%}
{% assign day = start_date | date: "%-d" -%}
{% assign year = start_date | date: "%Y" -%}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture pretty_date %}{{ day }} de {{ month }} de {{ year }}{% endcapture -%}

{% elsif start_date | date: "%Y-%m" == end_date | date: "%Y-%m" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{% capture pretty_date %}del {{ start_day }} al {{ end_day }} de {{ month }} de {{ year }}{% endcapture -%}

{% elsif start_date | date: "%Y" == end_date | date: "%Y" -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign year = start_date | date: "%Y" -%}
{% capture pretty_date %}del {{ start_day }} de {{ start_month }} al {{ end_day }} de {{ end_month }} de {{ year }}{% endcapture -%}

{% else -%}
{% assign start_day = start_date | date: "%-d" -%}
{% assign end_day = end_date | date: "%-d" -%}
{% capture start_month %}{% t "times.months.{{ start_date | date: '%B' }}" %}{% endcapture -%}
{% capture end_month %}{% t "times.months.{{ end_date | date: '%B' }}" %}{% endcapture -%}
{% assign start_year = start_date | date: "%Y" -%}
{% assign end_year = end_date | date: "%Y" -%}
{% capture pretty_date %}del {{ start_day }} de {{ start_month }} de {{ start_year }} al {{ end_day }} de {{ end_month }} de {{ end_year }}{% endcapture -%}
{% endif -%}
{% endif -%}{{ pretty_date | strip }}
Loading

0 comments on commit e5e916e

Please sign in to comment.