thegetty / quire

A multi-package repository for the Quire multiformat publishing framework
https://quire.getty.edu/
BSD 3-Clause "New" or "Revised" License
89 stars 10 forks source link

DEV-16233: Ensure `:href` is a dynamic attribute in `object-card.webc` #858

Closed anderspollack closed 9 months ago

anderspollack commented 10 months ago

Not sure when this regressed but links should point to object pages now, not literally "this.webc.attributes.url"

anderspollack commented 10 months ago

@geealbers I think this should also fix DEV-16234 as well, these were typos. Currently, you can set an alt on a thumbnail if you provide the thumbnail as an object like this:

object:
  - thumbnail:
    src: 'path/to/image`
    alt: 'Image Alt'
geealbers commented 9 months ago

@anderspollack, the links are working now, thanks! And the alt attributes are coming out blank by default, which is great but I can't get the thumbnail.src and thumbnail.alt thing to work, it throws this error:

[11ty] ENOENT: no such file or directory, lstat '_site/_assets/images/[object Object]' (via Error)
[11ty] 
[11ty] Original error stack trace: Error: ENOENT: no such file or directory, lstat '_site/_assets/images/[object Object]'
[11ty]     at Object.lstatSync (node:fs:1593:3)
[11ty]     at Object.lstatSync (/Users/galbers/test-pbject-filters/node_modules/graceful-fs/polyfills.js:318:34)
[11ty]     at statFunc (/Users/galbers/test-pbject-filters/node_modules/fs-extra/lib/util/stat.js:24:20)
[11ty]     at getStatsSync (/Users/galbers/test-pbject-filters/node_modules/fs-extra/lib/util/stat.js:25:19)
[11ty]     at Object.checkPathsSync (/Users/galbers/test-pbject-filters/node_modules/fs-extra/lib/util/stat.js:67:33)
[11ty]     at Object.copySync (/Users/galbers/test-pbject-filters/node_modules/fs-extra/lib/copy/copy-sync.js:27:38)
[11ty]     at AsyncEventEmitter.<anonymous> (/Users/galbers/test-pbject-filters/_plugins/transforms/outputs/epub/index.js:60:10)
[11ty]     at /Users/galbers/test-pbject-filters/node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js:19:61
[11ty]     at Array.map (<anonymous>)
[11ty]     at AsyncEventEmitter.emit (/Users/galbers/test-pbject-filters/node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js:19:34)

Here's the YAML I was using:

object: 
  - letter: "A"
    name: "Armchair"
    thumbnail: 
      src: "figures/things/armchair.jpg"
      alt: "An armchair made of wood and wicker."
    artist: Jean-Honoré Fragonard
    time_span: 1732–1806
anderspollack commented 9 months ago

@geealbers I fixed a separate bug in the alt function and ensured those are being markdownified, but the error you are seeing is because of the custom markup in the object armchair.md file:

{% for item in object %}
<img src="/_assets/images/{{ item.thumbnail }}" width="150"/>

is still looking for item.thumbnail, but it needs item.thumbnail.src in this instance. A very cryptic error message though...

geealbers commented 9 months ago

Doh! of course, sorry about that @anderspollack. thanks