A plugin for lkmlfmt.
pip install lkmlfmt lkmlfmt-djhtml
lkmlfmt --plugin lkmlfmt_djhtml [FILE]...
from lkmlfmt import fmt
lkml = fmt("""\
view: view_name {
dimension: column_name {
html:
{% if value == "foo" %}
<img src="https://example.com/foo"/>
{% else %}
<img src="https://example.com/bar"/>
{% endif %} ;;
}
}
""", plugins=["lkmlfmt_djhtml"])
assert lkml == """\
view: view_name {
dimension: column_name {
html:
{% if value == "foo" %}
<img src="https://example.com/foo"/>
{% else %}
<img src="https://example.com/bar"/>
{% endif %}
;;
}
}
"""