summaryrefslogtreecommitdiffhomepage
path: root/dlang/src/ocda/sqlite.d
AgeCommit message (Collapse)AuthorFilesLines
2026-10-02trackRalph Amissah1-0/+49
2026-10-02images from the source, and the epub segment fieldsRalph Amissah1-0/+21
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)
2026-09-25the abstraction as a library, and a defect it found at onceRalph Amissah1-0/+101
The readers each read one serialisation and print. A writer needs neither: it needs the document. So the model and both loaders live here, and a writer cannot tell which serialisation it was handed, exactly as spine own writers cannot. ocda.model imports nothing, which is the property that makes writers possible: they depend on the model and on neither loader. The model and the .ssp loader are the ssp-reader code, moved and renamed to the level they belong to: the model is neither the .ssp nor the .ocda.db. ocda.load_db is new, and returns the same value from sqlite that load_ssp returns from text. ocda.load is the one place that decides what a path is. The claim is only true if the two loaders agree, so test/agree.d asks: load a document both ways and compare the models object by object. It found a real defect on its first run. Eight of thirty-six disagreed, and the cause was the .ssp loader, not the formats: an object whose first text line is blank lost it, the loader having decided whether to start a new line by asking whether the accumulated text was empty, which is a different question from whether a line has been seen. Seven documents of the sample set have verse opening on a blank line and every one of them was wrong. Nothing else had caught it: the two .ssp readers were compared on section counts, which the bug does not disturb. It took loading one document two ways and comparing the objects. Fixed here, and in ssp-reader/dlang which carried the same code. 36 of 36 now agree. (assisted by Claude-Code) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>