« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateCoverArtwork.js11
-rw-r--r--src/content/dependencies/image.js8
2 files changed, 19 insertions, 0 deletions
diff --git a/src/content/dependencies/generateCoverArtwork.js b/src/content/dependencies/generateCoverArtwork.js
index 78a6103b..f9e942ff 100644
--- a/src/content/dependencies/generateCoverArtwork.js
+++ b/src/content/dependencies/generateCoverArtwork.js
@@ -44,6 +44,9 @@ export default {
 
     dimensions:
       artwork.dimensions,
+
+    style:
+      artwork.style,
   }),
 
   slots: {
@@ -73,6 +76,14 @@ export default {
   generate(data, relations, slots, {html}) {
     const {image} = relations;
 
+    const imgAttributes = html.attributes();
+
+    if (data.style) {
+      imgAttributes.add('style', data.style.split('\n').join(' '));
+    }
+
+    image.setSlot('imgAttributes', imgAttributes);
+
     image.setSlot('alt', slots.alt);
 
     const square =
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index bf47b14f..2ffa4c48 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -60,6 +60,12 @@ export default {
       mutable: false,
     },
 
+    // Added to the <img>.
+    imgAttributes: {
+      type: 'attributes',
+      mutable: false,
+    },
+
     // Added to the <img> itself.
     alt: {type: 'string'},
 
@@ -141,6 +147,8 @@ export default {
     const imgAttributes = html.attributes([
       {class: 'image'},
 
+      slots.imgAttributes,
+
       slots.alt && {alt: slots.alt},
 
       dimensions &&