diff options
| -rw-r--r-- | org/ocda.org | 74 | ||||
| -rw-r--r-- | org/ocda_obj_setter.org | 47 | ||||
| -rw-r--r-- | src/sisudoc/ocda/meta/metadoc_from_src.d | 74 | ||||
| -rw-r--r-- | src/sisudoc/ocda/meta/metadoc_object_setter.d | 47 |
4 files changed, 126 insertions, 116 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 diff --git a/org/ocda_obj_setter.org b/org/ocda_obj_setter.org index 7d74a6e..a6c25f2 100644 --- a/org/ocda_obj_setter.org +++ b/org/ocda_obj_setter.org @@ -142,19 +142,54 @@ struct DocObj_MetaInfo_ { #+NAME: meta_structs_docObjects #+BEGIN_SRC d -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 = []; diff --git a/src/sisudoc/ocda/meta/metadoc_from_src.d b/src/sisudoc/ocda/meta/metadoc_from_src.d index 229bff1..c5e2ce8 100644 --- a/src/sisudoc/ocda/meta/metadoc_from_src.d +++ b/src/sisudoc/ocda/meta/metadoc_from_src.d @@ -1552,65 +1552,35 @@ template docAbstraction() { 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; } // ← closed: abstract doc source 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 = []; |
