|
| 1 | +--- |
| 2 | +title: default-image-extension spurious append |
| 3 | +logo: assets/diagram.png |
| 4 | +imgdir: assets |
| 5 | +noext: figures/plot |
| 6 | +svgfile: figures/chart.svg |
| 7 | +format: html |
| 8 | +_quarto: |
| 9 | + tests: |
| 10 | + html: |
| 11 | + ensureFileRegexMatches: |
| 12 | + - |
| 13 | + # #14583: a shortcode resolving to a path that already has an extension |
| 14 | + # must not end up with a doubled extension |
| 15 | + - 'src="assets/diagram\.png"' |
| 16 | + # The doubled extension may be mismatched: a shortcode resolving to a |
| 17 | + # .svg path in an HTML doc (default png) becomes .svg.png; the spurious |
| 18 | + # .png must be stripped, leaving the real .svg |
| 19 | + - 'src="figures/chart\.svg"' |
| 20 | + # A shortcode resolving to an extensionless path keeps the appended |
| 21 | + # default extension (the multi-format workflow) |
| 22 | + - 'src="figures/plot\.png"' |
| 23 | + # Fix B: provably-spurious empty-filename URL has the extension stripped |
| 24 | + - 'src="https://example\.com/"' |
| 25 | + # Guard: local file without extension still gets default appended |
| 26 | + - 'src="images/screenshot\.png"' |
| 27 | + # Guard: user-typed URL with real extension is left unchanged |
| 28 | + - 'src="https://example\.com/logo\.png"' |
| 29 | + # Guard: data URI is left intact (no spurious extension) |
| 30 | + - 'src="data:image/png;base64,[^"]+"' |
| 31 | + # Guard: a shortcode mid-path with a real extension keeps that extension |
| 32 | + - 'src="assets/logo\.png"' |
| 33 | + - |
| 34 | + # No doubled extension survives the shortcode cases |
| 35 | + - 'diagram\.png\.png' |
| 36 | + - 'chart\.svg\.png' |
| 37 | + # Empty-filename URL must not be left with the appended extension |
| 38 | + - 'src="https://example\.com/\.png"' |
| 39 | + # Narrow URL fix must not strip a real extension off a user-typed URL |
| 40 | + - 'src="https://example\.com/logo"' |
| 41 | + # Mid-path shortcode source must not have its real extension stripped |
| 42 | + - 'src="assets/logo"' |
| 43 | + # Data URI must not have a spurious extension appended |
| 44 | + - 'base64,[^"]*\.png"' |
| 45 | +--- |
| 46 | + |
| 47 | +Shortcode resolving to an extensioned path — must not double (issue #14583): |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +Shortcode resolving to a path whose extension differs from the format default |
| 52 | +(here `.svg` in an HTML doc): the spurious default extension must be stripped: |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +Shortcode resolving to an extensionless path — multi-format append is kept: |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +User explicitly appends the default extension to a shortcode — preserved: |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +Empty-filename URL — embed/iframe syntax (issue #6092): |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +Local file without extension — multi-format workflow must keep the append: |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +User-typed URL with a real extension must stay untouched: |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +Data URI regression guard: |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +Shortcode mid-path with a real extension must keep the extension: |
| 81 | + |
| 82 | + |
0 commit comments