phore/template

将变量注入到模板中

dev-main 2024-04-19 09:32 UTC

This package is auto-updated.

Last update: 2024-09-19 10:23:49 UTC


README

用法

模板语法

  • ifdef - 如果变量已定义
  • ifndef - 如果变量未定义
  • for - 遍历列表

# Normal Variable substitution
Hello {{ name }}!

{% ifdef city %}
  Your city is {{ city }}.
{% endif %}

{% ifndef city %}
  Your city is {{ city }}.
{% endif %}

{% for cityList as city %}
  {{ city }}
{% endfor %}

# This is a comment! It will not be included to the output.

{{ name | uppercase }}

{{ dateList | each | uppercase }}

# Example on how to use filter with arguments
{{ curdate | dateFormat format="YYYY-MM-DD" }}