Remove unnecessary repeated definitions of the cleanup macro

This commit is contained in:
2023-07-01 14:08:40 -04:00
parent 1c51c678e5
commit 529b24e310
16 changed files with 152 additions and 315 deletions

View File

@ -1,6 +1,7 @@
>
{# Birthdays #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
<p>
{{ [
'Attention household, I am told that there is a birthday among us!',
@ -27,17 +28,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Daily Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'status.jinja' import houseStatusReport, tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
@ -312,18 +313,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen Morning Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import current_time, current_date_readout, input_datetime_read %}
{% from 'speech.jinja' import dadjoke, inspirational_quote %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
@ -191,17 +192,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen Nightly Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import dadjoke %}
{% from 'easy_time.jinja' import count_the_days, custom_time %}
<p>
@ -116,18 +117,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Kallen School Status #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'time.jinja' import input_datetime_read %}
<p>
"Hello Collin, "
@ -27,17 +28,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Morning Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting_nodate, dadjoke, inspirational_quote %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'easy_time.jinja' import count_the_days %}
@ -187,18 +188,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Nightly Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import greeting, dadjoke, inspirational_quote %}
{% from 'time.jinja' import input_datetime_read, time_from_calendar, next_twitch_stream %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
@ -230,17 +231,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Weather Briefing #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
<p>
{% if is_state('input_boolean.tornado_alarm','on') %}
@ -52,18 +53,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}

View File

@ -1,6 +1,7 @@
>
{# Welcome Home #}
{%- macro getReport() -%}
{% from 'formatting.jinja' import cleanup %}
{% from 'speech.jinja' import dadjoke %}
{% from 'time.jinja' import input_datetime_read %}
{% from 'status.jinja' import emma_sleep %}
@ -174,17 +175,4 @@
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}
{{- cleanup(getReport()) -}}