illustration.html 1.4 KB

1234567891011121314151617181920212223242526
  1. {% removeemptylines %}
  2. {% assign image = include.image | replace: '.svg', '' %}
  3. {% assign height = include.height | default: 128 %}
  4. {% assign src-light = "/illustrations/light/" | append: image %}
  5. {% assign src-dark = "/illustrations/dark/" | append: image %}
  6. {% assign illustration-light = site.illustrations | where: "id", src-light | first %}
  7. {% assign illustration-dark = site.illustrations | where: "id", src-dark | first %}
  8. {% assign replace-to-light = '<svg class="img-light' %}
  9. {% if include.class %}{% assign replace-to-light = replace-to-light | append: ' ' | append: include.class %}{% endif %}
  10. {% assign replace-to-light = replace-to-light | append: '" ' %}
  11. {% assign illustration-light = illustration-light | replace: '<svg ', replace-to-light %}
  12. {% assign replace-to-dark = '<svg class="img-dark' %}
  13. {% if include.class %}{% assign replace-to-dark = replace-to-dark | append: ' ' | append: include.class %}{% endif %}
  14. {% assign replace-to-dark = replace-to-dark | append: '" ' %}
  15. {% assign illustration-dark = illustration-dark | replace: '<svg ', replace-to-dark %}
  16. {% assign replace-to-height = 'height="' | append: height | append: '"' %}
  17. {% assign illustration-light = illustration-light | replace: 'width="800" height="600"', replace-to-height %}
  18. {% assign illustration-dark = illustration-dark | replace: 'width="800" height="600"', replace-to-height %}
  19. {{ illustration-light }}
  20. {{ illustration-dark }}
  21. {% endremoveemptylines %}