tags.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. {% macro render_tag(tag_class, tag_names, tag_props) %}
  2. {%- if tag_names -%}
  3. {%- if tag_names is string -%}
  4. {% set tag_names = [tag_names] %}
  5. {%- endif -%}
  6. {%- for tag_name in tag_names %}
  7. {%- set className = ["tag", tag_class.lower(), tag_name.lower().replace(' ', '-')] -%}
  8. {%- set dataName = tag_name.lower().replace(' ', '-') -%}
  9. <span title="{{ tag_class | title }}" class="{{ className | join(' ') }}" data-name="{{ dataName }}">
  10. {{- tag_name -}}
  11. {%- if tag_props -%}<span class="tag-badge">{{ tag_props }}</span>{%- endif -%}
  12. </span>
  13. {% endfor -%}
  14. {%- endif -%}
  15. {% endmacro %}
  16. {% macro render_tag_groups(tag_class, tag_names, tag_props) %}
  17. {%- if tag_names -%}
  18. {%- if tag_names is string -%}
  19. {% set tag_names = [tag_names] %}
  20. {%- endif -%}
  21. <span class="tag-groups" {% if tag_class != "langs" %}itemprop="description"{% endif %}> {{ tag_class }}:
  22. {%- for tag_name in tag_names %}
  23. {%- set className = ["tag", tag_class.lower(), tag_name.lower().replace(' ', '-')] -%}
  24. {%- set dataName = tag_name.lower().replace(' ', '-') -%}
  25. <span title="{{ tag_class | title }}" class="{{ className | join(' ') }}" data-name="{{ dataName }}"
  26. {% if tag_class == "langs" %}itemprop="programmingLanguage"{% endif %}>
  27. {{- tag_name -}}
  28. {%- if tag_props -%}<span class="tag-badge">{{ tag_props }}</span>{%- endif -%}
  29. </span>
  30. {% endfor -%}
  31. </span>
  32. {%- endif -%}
  33. {% endmacro %}