« get me outta code hell

content: flatten .square-content into .image-outer-area - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-13 17:15:24 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-13 17:16:29 -0400
commit410a4712ee0ebb25682b9c85e2c4f63fbd87993a (patch)
tree4148ee157aeaad1a4d6b54d47b134099d876ef3b
parent1d3eac688b0d800323a1db9fcaf598005f50051a (diff)
content: flatten .square-content into .image-outer-area
-rw-r--r--src/content/dependencies/image.js9
-rw-r--r--tap-snapshots/test/snapshot/image.js.test.cjs6
2 files changed, 6 insertions, 9 deletions
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index a39acca3..1582d3f4 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -317,13 +317,10 @@ export default {
 
       wrapped =
         html.tag('div', {class: 'image-outer-area'},
-          wrapped);
+          willSquare &&
+            {class: 'square-content'},
 
-      if (willSquare) {
-        wrapped =
-          html.tag('div', {class: 'square-content'},
-            wrapped);
-      }
+          wrapped);
 
       wrapped =
         html.tag('div', {class: 'image-container'},
diff --git a/tap-snapshots/test/snapshot/image.js.test.cjs b/tap-snapshots/test/snapshot/image.js.test.cjs
index 5661c9c7..ddfb3e6c 100644
--- a/tap-snapshots/test/snapshot/image.js.test.cjs
+++ b/tap-snapshots/test/snapshot/image.js.test.cjs
@@ -25,8 +25,8 @@ exports[`test/snapshot/image.js > TAP > image (snapshot) > content warnings via
 `
 
 exports[`test/snapshot/image.js > TAP > image (snapshot) > lazy with square 1`] = `
-<noscript><div class="image-container square"><div class="square-content"><div class="image-outer-area"><div class="image-inner-area"><img class="image" src="foobar"></div></div></div></div></noscript>
-<div class="image-container square js-hide"><div class="square-content"><div class="image-outer-area"><div class="image-inner-area"><img class="image lazy" data-original="foobar"></div></div></div></div>
+<noscript><div class="image-container square"><div class="image-outer-area square-content"><div class="image-inner-area"><img class="image" src="foobar"></div></div></div></noscript>
+<div class="image-container square js-hide"><div class="image-outer-area square-content"><div class="image-inner-area"><img class="image lazy" data-original="foobar"></div></div></div>
 `
 
 exports[`test/snapshot/image.js > TAP > image (snapshot) > link with file size 1`] = `
@@ -54,7 +54,7 @@ exports[`test/snapshot/image.js > TAP > image (snapshot) > source via src 1`] =
 `
 
 exports[`test/snapshot/image.js > TAP > image (snapshot) > square 1`] = `
-<div class="image-container square"><div class="square-content"><div class="image-outer-area"><div class="image-inner-area"><img class="image" src="foobar"></div></div></div></div>
+<div class="image-container square"><div class="image-outer-area square-content"><div class="image-inner-area"><img class="image" src="foobar"></div></div></div>
 `
 
 exports[`test/snapshot/image.js > TAP > image (snapshot) > thumb requested but source is gif 1`] = `