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 /src/sisudoc/ocda/meta/metadoc_object_setter.d | |
| 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 'src/sisudoc/ocda/meta/metadoc_object_setter.d')
| -rw-r--r-- | src/sisudoc/ocda/meta/metadoc_object_setter.d | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/src/sisudoc/ocda/meta/metadoc_object_setter.d b/src/sisudoc/ocda/meta/metadoc_object_setter.d index ba2f268..2eab062 100644 --- a/src/sisudoc/ocda/meta/metadoc_object_setter.d +++ b/src/sisudoc/ocda/meta/metadoc_object_setter.d @@ -56,19 +56,54 @@ module sisudoc.ocda.meta.metadoc_object_setter; @safe: template ObjectSetter() { /+ structs +/ - struct DocObj_TxtAttrib_ { - int indent_base = 0; - int indent_hang = 0; - bool bullet = false; - string language = ""; + /+ ↓ what a document has: the counts, the lists and the indexes that the + output writers ask doc_matters.has for. + . + plain data, so that it can be built by the parser, which has the whole + markup in front of it, or from a loaded abstraction, which has only + what the artefact carries. The member names are the ones the writers + already use, so which of the two built it is not visible downstream. + . + docSectKeysSeq() turns section_keys_sequenced into the per format + accessors (.scroll, .seg, .sql, .latex, .text) the writers walk. + +/ + struct ST_DocHas { + uint inline_links; + uint inline_notes_reg; + uint inline_notes_star; + uint codeblocks; + uint tables; + uint blocks; + uint groups; + uint poems; + uint quotes; + string[] imagelist; + string[][string] section_keys_sequenced; + string[] segnames_lv4; + string[] segnames_lv_0_to_4; + string[string][string] tag_associations; + ulong images() { + return imagelist.length; + } + auto keys_seq() { + import sisudoc.ocda.meta.metadoc_from_src_functions : docSectKeysSeq; + mixin docSectKeysSeq; + return docSectKeysSeq(section_keys_sequenced); + } } - struct DocObj_Has_ { + struct DocObj_Has_ { // review bool inline_links = false; bool inline_notes_reg = false; bool inline_notes_star = false; bool images = false; bool image_without_dimensions = false; } + struct DocObj_TxtAttrib_ { + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string language = ""; + } struct DocObj_Table_ { int number_of_columns = 0; double[] column_widths = []; |
