aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/meta
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-11 08:07:47 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-12 12:14:37 -0400
commit6a241cdc7368bf4cc23ffbc9e83f0adeadc35a9b (patch)
treea59a8bc2e29e7ba4063a1af402fdf51785f6def1 /src/sisudoc/ocda/meta
parent0.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/meta')
-rw-r--r--src/sisudoc/ocda/meta/metadoc_from_src_functions.d11
-rw-r--r--src/sisudoc/ocda/meta/rgx.d4
2 files changed, 11 insertions, 4 deletions
diff --git a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
index f51f6fe..77770f4 100644
--- a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
+++ b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
@@ -4278,12 +4278,17 @@ template docAbstractionFunctions() {
return ret;
}
// ↑ - section blurb
- // ↓ - images
+ /+ ↓ - images, the images an object shows.
+ matched on the internal markup an image has become by this stage
+ (┥☼name.png,w640h447 ┝┤├), so a filename-shaped word in prose is not
+ taken for one, and over every match rather than the first, so a
+ paragraph showing two images reports two.
+ +/
string[] extract_images()(string content_block) {
static auto rgx = RgxI();
string[] images_;
- if (auto m = content_block.matchAll(rgx.image)) {
- images_ ~= m.captures[1];
+ foreach (m; content_block.matchAll(rgx.image_in_object_text)) {
+ images_ ~= m["image"].to!string;
}
return images_;
}
diff --git a/src/sisudoc/ocda/meta/rgx.d b/src/sisudoc/ocda/meta/rgx.d
index 357df25..4ade610 100644
--- a/src/sisudoc/ocda/meta/rgx.d
+++ b/src/sisudoc/ocda/meta/rgx.d
@@ -158,7 +158,9 @@ static template spineRgxIn() {
static smid_inline_link_markup_regular = ctRegex!(`(?P<pre>^|[ (\[])\{\s*(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
static smid_inline_link_endnote_url_helper_punctuated = ctRegex!(`\{~\^\s+(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[.,;:?!]?([ ]|$))`, "mg");
static smid_inline_link_endnote_url_helper = ctRegex!(`\{~\^\s+(?P<content>.+?)\s*\}(?P<link>(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+)`, "mg");
- static image = ctRegex!(`([a-zA-Z0-9._-]+?\.(?:png|gif|jpg))`, "mg");
+ /+ image post internal markup ┥☼name.png,w640h447 ┝┤├ +/
+ static image_in_object_text = ctRegex!(`☼(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg)),w\d+h\d+`, "mg");
+ /+ smid_image for sisu markup source (.sst) images `{ name.png }image` +/
static smid_image = ctRegex!(`(?P<pre>(?:^|[ ])[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");
static smid_image_generic = ctRegex!(`(?:^|[ ])[{┥](?:~\^\s+|\s*)\S+\.(?:png|gif|jpg).*?[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$))`, "mg");
static smid_image_with_dimensions = ctRegex!(`(?P<pre>(?:^|[ ])[{┥](?:~\^\s+|\s*))(?P<image>[a-zA-Z0-9._-]+?\.(?:png|gif|jpg))\s+(?P<width>\d+)x(?P<height>\d+)\s*(?P<post>(?:.*?)\s*[}┝](?:image|┤.*?├|(?:(?:https?|git):\/\/|¤?\.\.\/|¤?\.\/|¤|#)\S+?)(?=[;:!,?.]?([ )\]]|$)))`, "mg");