From 4101c83a16ce715c84d353572bd0f231059bfbac Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 19 Jun 2018 12:17:37 -0400 Subject: make string object_number a property of int o_n --- src/sdp/meta/object_setter.d | 69 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 14 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 840a71c..967f9ec 100644 --- a/src/sdp/meta/object_setter.d +++ b/src/sdp/meta/object_setter.d @@ -6,28 +6,33 @@ module sdp.meta.object_setter; template ObjectSetter() { /+ structs +/ - struct DocObj_TypeInfo_ { + struct DocObj_TypeInfo_ { // typeinfo string of_part = ""; // frontmatter, body, backmatter string of_section = ""; // toc, body, glossary, biography, book index, blurb string is_of = ""; // para, block ? string is_a = ""; // heading, para, table, code block, group, ... } - struct DocObj_TxtAttrib_ { + struct DocObj_TxtAttrib_ { // attrib int indent_base = 0; int indent_hang = 0; bool bullet = false; string language = ""; // not implemented, consider } - struct DocObj_Has_ { + 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_ { + struct DocObj_Node_ { // node string[string][string] node; - int ocn = 0; // duplicated as string with object_number - string object_number = ""; // duplicated as int with ocn may apply additional info for backmatter (glossary, biblio etc.) + int ocn = 0; + string object_number() const @property { + return (ocn==0) + ? "" + : ocn.to!string; + } + string ocn_type = ""; // code duplicated typeinfo is_a string marked_up_level = "9"; int heading_lev_markup = 9; int heading_lev_collapsed = 9; @@ -38,22 +43,22 @@ template ObjectSetter() { int parent_ocn = 0; int[] ancestors = []; } - struct DocObj_Table_ { + 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_ { + struct DocObj_CodeBlock_ { // code_block string syntax = ""; } - struct DocObj_Pointer_ { + struct DocObj_Pointer_ { // ptr int doc_object = 0; int html_segnames = 0; int heading = 0; } - struct DocObj_Tags_ { + struct DocObj_Tags_ { // tags string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; string segment_anchor_tag = ""; string segname_prev = ""; @@ -61,10 +66,46 @@ template ObjectSetter() { string[] lev4_subtoc = []; string[] anchor_tags = []; } - struct DocObj_Misc_ { - string object_number_bkidx = ""; - string object_number_off = ""; - int object_number_type = 0; // { ocn, non, bkidx } + struct DocObj_Misc_ { // misc + int o_n_substantive = 0; + int o_n_non_substantive = 0; + int o_n_glossary = 0; + int o_n_bibliography = 0; + int o_n_book_index = 0; + int o_n_blurb = 0; + string object_number_substantive() const @property { + return (o_n_substantive==0) + ? "" + : o_n_substantive.to!string; + } + string object_number_non_substantive() const @property { + return (o_n_non_substantive==0) + ? "" + : o_n_non_substantive.to!string; + } + string object_number_glossary() const @property { + return (o_n_glossary==0) + ? "" + : o_n_glossary.to!string; + } + string object_number_bibliography() const @property { + return (o_n_bibliography==0) + ? "" + : o_n_bibliography.to!string; + } + string object_number_book_index() const @property { + return (o_n_book_index==0) + ? "" + : o_n_book_index.to!string; + } + string object_number_blurb() const @property { + return (o_n_blurb==0) + ? "" + : o_n_blurb.to!string; + } + string object_number_off = ""; + bool visible_object_number = false; + int object_number_type = 0; // { ocn, non, bkidx } } struct ObjGenericComposite { string text = ""; -- cgit v1.2.3