diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-11 08:07:47 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-12 12:14:37 -0400 |
| commit | 6a241cdc7368bf4cc23ffbc9e83f0adeadc35a9b (patch) | |
| tree | a59a8bc2e29e7ba4063a1af402fdf51785f6def1 /src/sisudoc/ocda/io_in | |
| parent | 0.23.0 (diff) | |
ocda: get image from is internal image markup
correct circumstance where regex was incorrectly able to match image
shaped words as well as identified and marked up image
(internal markup).
take all matches.
(assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc/ocda/io_in')
| -rw-r--r-- | src/sisudoc/ocda/io_in/read_source_files.d | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sisudoc/ocda/io_in/read_source_files.d b/src/sisudoc/ocda/io_in/read_source_files.d index 720ee63..f99bb9b 100644 --- a/src/sisudoc/ocda/io_in/read_source_files.d +++ b/src/sisudoc/ocda/io_in/read_source_files.d @@ -67,11 +67,16 @@ template spineRawMarkupContent() { mixin spineRgxFiles; static auto rgx_files = RgxFiles(); string[] _images=[]; + /+ ↓ the images a markup source shows. + matched on the image markup itself ({ name.png }image, and the url and + ~^ forms), ensure a filename-shaped word in prose is not mistaken for + one, and over every match (so a line showing two images reports two). + +/ string[] _extract_images(S)(S content_block) { string[] images_; string _content_block = content_block.to!string; - if (auto m = _content_block.matchAll(rgx.image)) { - images_ ~= m.captures[1].to!string; + foreach (m; _content_block.matchAll(rgx.smid_image)) { + images_ ~= m["image"].to!string; } return images_; } |
