home-assistant-configuration/config/templates/twitter_great_content.yaml

29 lines
1.1 KiB
YAML
Raw Normal View History

>
2020-04-10 16:41:46 +00:00
{# Twitter Great Content #}
{%- macro getRandomPromo() -%}
{{- [
"Checkout one of my favorite Home Assistant Youtubers @ccostan at https://www.youtube.com/channel/UC301G8JJFzY0BZ_0lshpKpQ ",
"Looking for some great Home Assistant content? @BeardedTinker has you covered. Subscribe at https://www.youtube.com/c/BeardedTinker ",
"Want some cool Home Assistant project ideas? @EverySmartHome has something for you at https://www.youtube.com/c/EverythingSmartHome"
] | random -}}
2020-04-10 16:41:46 +00:00
{%- endmacro -%}
{%- macro getTags() -%}
#homeassistant #youcandoit #givingback
2020-04-10 16:41:46 +00:00
{%- 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 -%}
2020-04-10 16:41:46 +00:00
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getRandomPromo() }}
{{ getTags() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}