diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-11 11:37:35 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-12 12:14:39 -0400 |
| commit | c9089281e09f82db58f5538a84385717cd5897a5 (patch) | |
| tree | ce7fdc4b6f46d447748a917ec098705d1d2bac66 /org/ocda.org | |
| parent | ocda: reading .ocda.db now faster than parsing markup (diff) | |
ocda: what a document has, as plain data
ST_DocHas in metadoc_object_setter, filled by the parser, in place of
DocHas_, a struct of accessors nested inside docAbstraction() that
closed over the parser's locals. The member names are the ones the
output writers already use, so nothing downstream changes.
The point is that a struct closing over parser locals can only ever be
built by the parser. A document loaded from a .ssp or a .ocda.db has to
arrive at the same value with only what the artefact carries, and now
there is something for it to fill.
Two small things fall out. imagelist is a string[] rather than the lazy
uniq range it was, and images() is therefore imagelist.length rather
than counting the commas in the range's string representation, which
carried a "TODO not ideal rethink". Same answer unless a filename
contains a comma; the reference test agrees on all 35.
(assisted by Claude-Code)
Diffstat (limited to 'org/ocda.org')
| -rw-r--r-- | org/ocda.org | 74 |
1 files changed, 22 insertions, 52 deletions
diff --git a/org/ocda.org b/org/ocda.org index 535cd94..1fd3cb1 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -1668,65 +1668,35 @@ content_non_header = "8"; lev_anchor_tag = ""; anchor_tag = ""; // identify parts -struct DocHas_ { - uint inline_links() { - return dochas["inline_links"]; - } - uint inline_notes_reg() { - return dochas["inline_notes"]; - } - uint inline_notes_star() { - return dochas["inline_notes_star"]; - } - uint codeblocks() { - return dochas["codeblock"]; - } - uint tables() { - return dochas["table"]; - } - uint blocks() { - return dochas["block"]; - } - uint groups() { - return dochas["group"]; - } - uint poems() { - return dochas["poem"]; - } - uint quotes() { - return dochas["quote"]; - } - ulong images() { // TODO not ideal rethink - return (image_list.to!string.strip("[","]").split(",").length); - } - auto imagelist() { - return image_list; - } - auto keys_seq() { - return docSectKeysSeq!()(document_section_keys_sequenced); - } - string[] segnames_lv4() { - return segnames_4; - } - string[] segnames_lv_0_to_4() { - return segnames_0_to_4; - } - string[string][string] tag_associations() { - return tag_assoc; - } -} -DocHas_ doc_has() { - return DocHas_(); -} +/+ ↓ what the document has, as plain data. ST_DocHas is in + metadoc_object_setter so that it can also be built from a loaded + abstraction, without the parser's locals to hand ++/ +ST_DocHas doc_has_ = { + inline_links : dochas["inline_links"], + inline_notes_reg : dochas["inline_notes"], + inline_notes_star : dochas["inline_notes_star"], + codeblocks : dochas["codeblock"], + tables : dochas["table"], + blocks : dochas["block"], + groups : dochas["group"], + poems : dochas["poem"], + quotes : dochas["quote"], + imagelist : image_list.array, + section_keys_sequenced : document_section_keys_sequenced, + segnames_lv4 : segnames_4, + segnames_lv_0_to_4 : segnames_0_to_4, + tag_associations : tag_assoc, +}; // the doc to be returned struct ST_docAbstraction { ObjGenericComposite[][string] document_the; - DocHas_ doc_has; + ST_DocHas doc_has; } ST_docAbstraction ret; { ret.document_the = document_the; - ret.doc_has = doc_has; + ret.doc_has = doc_has_; } return ret; #+END_SRC |
