{% removeemptylines %}

{% assign icon-name = include.icon %}

{% assign replace-to = "icon" %}

{% if include.class %}
{% assign replace-to = replace-to | append: ' ' | append: include.class %}
{% endif %}

{% if include.color %}
{% assign replace-to = replace-to | append: ' text-' | append: include.color %}
{% endif %}

{% if include.filled %}
{% assign replace-to = replace-to | append: ' icon-filled' %}
{% endif %}

{% if include['size'] %}
{% assign replace-to = replace-to | append: ' icon-' | append: include['size'] %}
{% endif %}

{% assign replace-to = 'class="' | append: replace-to | append: '"' %}

{% if site.use-iconfont %}
	<i class="icon ti ti-{{ icon-name }}{% if include.color %} {{ include.color }}{% endif %}{% if include.filled %} icon-filled{% endif %}{% if include.class %} {{ include.class }}{% endif %}"></i>
{% else %}
	{% assign svg-icon = site.data.icons[icon-name] | default: '' %}
	{{ svg-icon | replace_regex: 'class=\"[^"]+\"', replace-to }}
{% endif %}

{% endremoveemptylines %}
