|
4 | 4 | -- Split in a standalone package so that it can be reused and |
5 | 5 | -- generalized somewhat independently from the underlying parsing code. |
6 | 6 | -- |
7 | | --- @copyright License: MIT (c) 2022-2024 Omikhleia, Didier Willis |
| 7 | +-- @copyright License: MIT (c) 2022-2025 Omikhleia, Didier Willis |
8 | 8 | -- @module packages.markdown.commands |
9 | 9 | -- |
10 | 10 | require("silex.lang") -- Compatibility layer |
@@ -103,7 +103,9 @@ local function decimalFilter (input, _) |
103 | 103 | end |
104 | 104 |
|
105 | 105 | local function wrapLinkContent (options, content) |
106 | | - local passedOptions = pl.tablex.copy(options) -- shallow |
| 106 | + -- shallow copy before removing internal options |
| 107 | + -- (Content may be reused in pseudo-symbol macros or other means) |
| 108 | + local passedOptions = pl.tablex.copy(options) |
107 | 109 | -- We already took care of these. |
108 | 110 | passedOptions.src = nil |
109 | 111 | passedOptions.id = nil |
@@ -247,9 +249,12 @@ function package:registerCommands () |
247 | 249 | -- We'll want the ID to apply to the captioning environment (to potentially |
248 | 250 | -- use the caption numbering) |
249 | 251 | local id = image.options.id |
250 | | - image.options.id = nil |
| 252 | + local imgOptions = pl.tablex.copy(image.options) |
| 253 | + -- Shallow copy before removing internal options |
| 254 | + -- (Content may be reused in pseudo-symbol macros or other means) |
| 255 | + imgOptions.id = nil |
251 | 256 | -- We also propagate image options to the englobing environment |
252 | | - SILE.call("markdown:internal:captioned-figure", image.options, { |
| 257 | + SILE.call("markdown:internal:captioned-figure", imgOptions, { |
253 | 258 | image, |
254 | 259 | createCommand("caption", {}, { |
255 | 260 | createCommand("label", { marker = id }), |
@@ -508,6 +513,9 @@ Please consider using a resilient-compatible class!]]) |
508 | 513 | if not (self.hasPackageSupport.piecharts or self.hasPackageSupport.piechart) then -- HACK Some early versions of piecharts have the wrong internal name |
509 | 514 | SU.error("No piecharts package available to render CSV data ".. uri) |
510 | 515 | end |
| 516 | + -- Shallow copy before removing internal options |
| 517 | + -- (Content may be reused in pseudo-symbol macros or other means) |
| 518 | + options = pl.tablex.copy(options) |
511 | 519 | options.src = nil |
512 | 520 | options.csvfile = uri |
513 | 521 | SILE.call("piechart", options) |
@@ -848,6 +856,9 @@ Please consider using a resilient-compatible class!]]) |
848 | 856 | local text = ":" .. symbol .. ":" |
849 | 857 | content = { text } |
850 | 858 | end |
| 859 | + -- Shallow copy before removing internal options |
| 860 | + -- (Content may be reused in pseudo-symbol macros or other means) |
| 861 | + options = pl.tablex.copy(options) |
851 | 862 | options._symbol_ = nil |
852 | 863 | options._standalone_ = nil |
853 | 864 | if next(options) and not standalone then |
|
0 commit comments