10 Commits
Author SHA1 Message Date
John MacFarlane f2092f82ff SelfContained: only create svg elements for SVG images when...
...the image has the class `inline-svg`. Otherwise just use a
`data` URI as we do with other images.

Closes #9787.
2024-06-10 10:59:16 -07:00
John MacFarlane 67fa6cda5c SelfContained: add role="img" to svgs.
This is needed in conjunction with `aria-label` for screen
readers. Completes the fix to #9525.
2024-02-29 12:48:27 -08:00
John MacFarlane 85b3ac3ee1 SelfContained: Add aria-label to svg elements.
Screen readers don't seem to pay attention to an alt attribute on
svg.  But they do read the aria-label. So if there's an alt
attribute, we copy its contents to aria-label, unless there is
already an aria-label. This will make pandoc's output with
`--embed-resources` more accessible.

Closes #9525.
2024-02-29 12:08:02 -08:00
John MacFarlane ea23868ae4 Fix size of duplicated SVGs with --embed-resources.
Closes #9439.
2024-02-09 16:39:40 -08:00
John MacFarlane 6149cec27a Update command test for SVG embedding changes. 2023-11-25 11:39:22 -05:00
John MacFarlane 7b8e8f6f52 SelfContained: retain attributes in svg tag...
when referring to another svg's content using `<use>`.
Closes #8969.
2023-07-27 09:56:56 -06:00
John MacFarlane ecb59e1cde SelfContained: fix calculation of svg width and height.
We were computing width and height from viewBox incorrectly.
See #8969.
2023-07-26 09:49:37 -06:00
John MacFarlane 704a07d963 SelfContained: Improve inline SVGs.
- Ensure that width and height attributes don't get specified
  twice is both the img tag and the svg include them.
- Omit unnecessary attributes xmlns, xmlns:xlink, and version on
  svg element.
- Use 20 character rather than 40 character hashes for generated IDs.

Closes #8965.
2023-07-25 23:24:43 -06:00
John MacFarlane a97b270b28 Fix bugs in implementation of #8948. 2023-07-13 07:49:13 -07:00
John MacFarlane 94832af98a SelfContained: Use inline svg instead of data uris...
for SVG images in HTML5. Closes #8948.

Note that SelfContained does not have access to the writer
name, so we check for HTML5 by determining whether the document
starts with `<DOCTYPE! html>`. This means that inline SVG
won't be used when generating document fragments.

An API change could be contemplated to give more flexibility,
but this is okay for now.
2023-07-11 10:59:33 -07:00