Remove unnecessary repeated definitions of the cleanup macro
This commit is contained in:
@ -177,6 +177,7 @@ sensor:
|
||||
mdi:calendar-end
|
||||
{% endif %}
|
||||
value_template: >
|
||||
{% from 'formatting.jinja' import cleanup %}
|
||||
{%- macro getReport() -%}
|
||||
{% set week = states('sensor.kallen_lunch_menu_week') %}
|
||||
{% set dow = now().strftime('%A') %}
|
||||
@ -232,17 +233,7 @@ sensor:
|
||||
No menu for the current day.
|
||||
{% endif %}
|
||||
{%- 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()) -}}
|
||||
|
||||
|
||||
# - platform: rest
|
||||
|
Reference in New Issue
Block a user