diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-26 09:47:07 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-10-02 21:38:33 -0400 |
| commit | 6c14c162bdec65934fbda3b14295efcfc12d28d2 (patch) | |
| tree | 03248ba59d26ee584cbb428caf7d3795ea592ced /gleam/src/ocda/model.gleam | |
| parent | two fields the model was missing, found by writing an html writer (diff) | |
images from the source, and the epub segment fields
Two additions the epub writer needed and could not have without.
ocda.images: an image's bytes, from whichever input form the document came
from. The model names images, with digest, byte size and pixel size, and
does not hold them - which is right, an abstraction is not a bundle of
assets - so something has to know where they are, and the answer depends
on the input form rather than on the output. Hence the library.
.ocda.db the files table, role 'image', by name
.sisupod the archive entry whose path ends in /image/<name>
.zip the same
.ssp beside it: a pod puts the abstraction in media/abstraction/
and its images in media/image/, so the path is documented
rather than guessed
canGiveImages says whether a source can answer at all, because a writer
has to know before it emits an <img>: a manifest item whose file is absent
and an <img> whose file is not in the manifest are both epubcheck errors.
A .ssp outside a pod has nowhere to look, and that is absence rather than
error - the document is still readable.
Reading a blob needed sqlite3_column_blob rather than _column_text: an
image read as text stops at the first zero byte, and a png's ninth byte
is zero.
And two more model fields: segment_epub and segment_epub_is. The epub
segments at heading levels 1 to 4 where the html segments at level 4
alone, so the two are different files and the abstraction records both.
Nine of the 36 documents have images; the four-way agreement still holds
at 36 of 36 each way.
(assisted by Claude-Code)
Diffstat (limited to 'gleam/src/ocda/model.gleam')
| -rw-r--r-- | gleam/src/ocda/model.gleam | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gleam/src/ocda/model.gleam b/gleam/src/ocda/model.gleam index a45cf6e..050a97b 100644 --- a/gleam/src/ocda/model.gleam +++ b/gleam/src/ocda/model.gleam @@ -85,6 +85,8 @@ pub type Object { /// the object's own section, when it differs from the block it sits in own_section: String, segment_html_is: String, + segment_epub: String, + segment_epub_is: String, table_aligns: String, stow_link: List(String), anchor_tags: List(String), @@ -130,6 +132,8 @@ pub fn new_object() -> Object { is_of_type: "", own_section: "", segment_html_is: "", + segment_epub: "", + segment_epub_is: "", table_aligns: "", stow_link: [], anchor_tags: [], |
