aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_sqlite.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-13 21:56:43 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-14 12:18:51 -0400
commiteb5a9f3dab1d1848a1aa90c534a125c222327635 (patch)
tree92e53a0c8cf7c3d3dddef14d82730cdf99b6e4b9 /org/out_sqlite.org
parentepub and html: no errors left over the sample set (diff)
images alt text, and epub says what it is
Four things, not visible in an error count: - Images had no alt text, even where markup carried the text, and the field alt text is present, incorrectly used in code; fixed as the alt. { sm_tux.png 64x80 "Gnu/Linux - a better way" }image an image with nothing to say for itself gets alt="" - Images with no dimensions were incorrectly written width="0" height="0", fixed - Accessibility metadata, which EPUB Accessibility 1.1 requires: schema:accessMode, accessibilityFeature and accessibilityHazard, plus accessModeSufficient and accessibilitySummary, which epubcheck does not test for; used by - readers looking for a book it can use, - anyone distributing into the EU. Every value is derived from the document, not asserted: a document with no images says so, one whose images all carry alt text claims alternativeText and textual sufficiency, one where an image says nothing claims neither. Nothing claims WCAG conformance, which would be a claim about an evaluation that has not happened. - DPUB-ARIA roles beside the structure spine already knew about. doc-toc, doc-endnotes, doc-bibliography, doc-glossary and doc-index on the sections, doc-noteref on a note reference and doc-footnote on the note it points at. "doc_endnotes" as a class name means something to a stylesheet and nothing to a reading system. Not doc-biblioentry: DPUB- ARIA 1.1 deprecated it. These are plain ARIA, so the html gets them too. Also dealt with here: - Spine makes certain sections such as endnotes, bookindex, ... and a heading that has a name for itself cannot share the same name, if it does the name is now disambiguated, disambiguated. (disambiguation similar to that used for a repeated anchor tag) - Endnote anchors fixed to use "id" (being one unique tag in the document that is target of every reference to it)instead of obsolete form (they were <a name="note_1">. "name" on an <a>). Book index markers keep "name": the same marker sits on every object an entry names, 296 times in one document, and those are markers of where a term occurs rather than distinct targets. (assisted by Claude-Code)
Diffstat (limited to 'org/out_sqlite.org')
-rw-r--r--org/out_sqlite.org36
1 files changed, 31 insertions, 5 deletions
diff --git a/org/out_sqlite.org b/org/out_sqlite.org
index a9f1065..418b2d3 100644
--- a/org/out_sqlite.org
+++ b/org/out_sqlite.org
@@ -875,14 +875,40 @@ string inline_images(M,O)(
_img_pth = "../../../image/";
}
if (_txt.match(rgx.inline_image)) {
- _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
- rgx.inline_image,
- ("$1<img src=\""
- ~ _img_pth
- ~ "$3\" width=\"$4\" height=\"$5\" /> $6"));
+ _txt = replaceAll!(m =>
+ m["pre"].to!string
+ ~ _img_element(_img_pth ~ m["img"].to!string, m["width"].to!string,
+ m["height"].to!string, _image_alt(m["post"].to!string))
+ ~ " " ~ _image_rest(m["post"].to!string)
+ )(_txt, rgx.inline_image);
}
return _txt;
}
+/+ ↓ the same treatment of an image as the html and epub writers give
+ it, because this is the html the cgi search renders: the markup's
+ description is the alt text, and dimensions that are not there are
+ not written as zeroes.
++/
+string _image_alt(string _post) {
+ if (auto m = _post.matchFirst(rgx.inline_image_alt)) {
+ return m["alt"].to!string;
+ }
+ return "";
+}
+string _image_rest(string _post) {
+ if (auto m = _post.matchFirst(rgx.inline_image_alt)) {
+ return m.post.to!string;
+ }
+ return _post;
+}
+string _img_element(string _src, string _w, string _h, string _alt) {
+ string _dim = (_w == "0" && _h == "0")
+ ? ""
+ : " width=\"" ~ _w ~ "\" height=\"" ~ _h ~ "\"";
+ return "<img src=\"" ~ _src ~ "\""
+ ~ " alt=\"" ~ html_special_characters(_alt) ~ "\""
+ ~ _dim ~ " />";
+}
#+END_SRC
******* links