From b86c91d6136476de3a35e0077db28caccacd816e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Jun 2018 11:42:14 -0400 Subject: doc object metainfo consolidation --- src/sdp/meta/object_setter.d | 150 +++++++++++++++++++++++++------------------ 1 file changed, 89 insertions(+), 61 deletions(-) (limited to 'src/sdp/meta/object_setter.d') diff --git a/src/sdp/meta/object_setter.d b/src/sdp/meta/object_setter.d index 77e44e0..a928ec8 100644 --- a/src/sdp/meta/object_setter.d +++ b/src/sdp/meta/object_setter.d @@ -6,7 +6,7 @@ module sdp.meta.object_setter; template ObjectSetter() { /+ structs +/ - struct DocObj_TypeInfo_ { // typeinfo + struct DocObj_MetaInfo_ { // metainfo string is_of_part = ""; // frontmatter, body, backmatter string is_of_section = ""; // toc, body, glossary, biography, book index, blurb string is_of_type = ""; // para, block ? @@ -14,63 +14,7 @@ template ObjectSetter() { alias of_part = is_of_part; alias of_section = is_of_section; alias is_of = is_of_type; - } - struct DocObj_TxtAttrib_ { // attrib - int indent_base = 0; - int indent_hang = 0; - bool bullet = false; - string language = ""; // not implemented, consider - } - struct DocObj_Has_ { // has - bool inline_links = false; - bool inline_notes_reg = false; - bool inline_notes_star = false; - bool contains_image_without_dimensions = false; - } - struct DocObj_Node_ { // node - enum ONtype { none, substantive, non_substantive, glossary, bibliography, book_index, blurb, comment } - string[string][string] node; - int ocn = 0; - string object_number() const @property { - return (ocn==0) - ? "" - : ocn.to!string; - } - int o_n_type = 0; - string marked_up_level = "9"; - int heading_lev_markup = 9; - int heading_lev_collapsed = 9; - int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int[] heading_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; - int parent_lev_markup = 0; - int parent_ocn = 0; - int[] ancestors = []; - } - struct DocObj_Table_ { // table - int number_of_columns = 0; - double[] column_widths = []; - string[] column_aligns = []; - bool heading = false; - bool walls = false; // not implemented - } - struct DocObj_CodeBlock_ { // code_block - string syntax = ""; - } - struct DocObj_Pointer_ { // ptr - int doc_object = 0; - int html_segnames = 0; - int heading = 0; - } - struct DocObj_Tags_ { // tags - string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; - string segment_anchor_tag = ""; - string segname_prev = ""; - string segname_next = ""; - string[] lev4_subtoc = []; - string[] anchor_tags = []; - } - struct DocObj_Misc_ { // misc + /+ o_n +/ int o_n_substantive = 0; int o_n_non_substantive = 0; int o_n_glossary = 0; @@ -109,19 +53,103 @@ template ObjectSetter() { } string object_number_off = ""; bool visible_object_number = false; + // enum ONtype { none, substantive, non_substantive, glossary, bibliography, book_index, blurb, comment } int object_number_type = 0; // { ocn, non, bkidx } + /+ node +/ + string[string][string] node; + int ocn = 0; + string object_number() const @property { + return (ocn==0) + ? "" + : ocn.to!string; + } + int o_n_type = 0; + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + string marked_up_level() const @property { + string _out; + switch (heading_lev_markup) { + case 0: + _out = "A"; + break; + case 1: + _out = "B"; + break; + case 2: + _out = "C"; + break; + case 3: + _out = "D"; + break; + case 4: + _out = "1"; + break; + case 5: + _out = "2"; + break; + case 6: + _out = "3"; + break; + case 7: + _out = "4"; + break; + default: + _out = ""; + break; + } + return _out; + } + int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int[] heading_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,]; + int parent_lev_markup = 0; + int parent_ocn = 0; + int[] ancestors = []; + } + struct DocObj_TxtAttrib_ { // attrib + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string language = ""; // not implemented, consider + } + struct DocObj_Has_ { // has + bool inline_links = false; + bool inline_notes_reg = false; + bool inline_notes_star = false; + bool contains_image_without_dimensions = false; + } + struct DocObj_Table_ { // table + int number_of_columns = 0; + double[] column_widths = []; + string[] column_aligns = []; + bool heading = false; + bool walls = false; // not implemented + } + struct DocObj_CodeBlock_ { // code_block + string syntax = ""; + } + struct DocObj_Pointer_ { // ptr + int doc_object = 0; + int html_segnames = 0; + int heading = 0; + } + struct DocObj_Tags_ { // tags + string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; + string segment_anchor_tag = ""; + string segname_prev = ""; + string segname_next = ""; + string[] lev4_subtoc = []; + string[] anchor_tags = []; } struct ObjGenericComposite { string text = ""; - DocObj_TypeInfo_ typeinfo; + DocObj_MetaInfo_ metainfo; DocObj_TxtAttrib_ attrib; DocObj_Tags_ tags; DocObj_Has_ has; DocObj_Table_ table; DocObj_CodeBlock_ code_block; - DocObj_Misc_ misc; DocObj_Pointer_ ptr; - DocObj_Node_ node; } struct TheObjects { ObjGenericComposite[] oca; -- cgit v1.2.3