illustration.html 1.4 KB

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