diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-12-11 11:17:06 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | 762439ade3de42d2043fafc0005b255c6c58ba49 (patch) | |
tree | 9d1c66d345bffd1b15002265e73c97c1fc92c70d /src/sdp/ao_object_setter.d | |
parent | 0.9.6 node info, and output continued (diff) |
0.10.0 generic object (ObjGenericComposite), removed "object_set"
Diffstat (limited to 'src/sdp/ao_object_setter.d')
-rw-r--r-- | src/sdp/ao_object_setter.d | 219 |
1 files changed, 39 insertions, 180 deletions
diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index 9806285..f6f7641 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -7,187 +7,46 @@ template ObjectSetter() { /+ structs +/ struct HeadingAttrib { string lev = "9"; - int lev_int_markup = 9; - int lev_int_collapsed = 9; - int[] closes_lev_collapsed = []; // TODO track - int[] closes_lev_markup = []; // TODO track - int array_ptr = 0; - // heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO - } - struct ParaAttrib { - int indent_start = 0; - int indent_rest = 0; - bool bullet = false; - } - struct BlockAttrib { - string syntax = ""; - } - struct Comment { - // no .attrib and no .obj_cite_number - } - struct Node { - int ocn = 0; - string seg_anchor_tag = ""; - // parent - int parent_lev_int_markup = 0; - int parent_ocn = 0; - int[] ancestors = []; // TODO track - // heading: - int heading_lev_int_markup = 0; - int heading_lev_int_collapsed = 0; - int[] heading_closes_lev_collapsed = []; // TODO track - int[] heading_closes_lev_markup = []; // TODO track - int heading_array_ptr = 0; - // heading segments, 1~ lev4: - int heading_array_ptr_segments = 0; // TODO - // node info json string: + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int array_ptr = 0; + int heading_array_ptr_segments = 0; + } + struct ObjGenericComposite { + // size_t id; + string use = ""; + string of = ""; + string is_a = ""; + string text = ""; + string obj_cite_number = ""; + string[] anchor_tags = []; + string marked_up_level = "9"; + int[] closes_lev_collapsed = []; + int[] closes_lev_markup = []; + int indent_base = 0; + int indent_hang = 0; + bool bullet = false; + string syntax = ""; + int ocn = 0; + string segment_anchor_tag = ""; + int parent_lev_markup = 0; + int parent_ocn = 0; + int[] ancestors = []; + int heading_lev_markup = 9; + int heading_lev_collapsed = 9; + int[] heading_closes_lev_collapsed = []; + int[] heading_closes_lev_markup = []; + int heading_array_ptr = 0; + int ptr_doc_object = 0; + int ptr_html_segnames = 0; + int ptr_heading = 0; + int array_ptr = 0; + int heading_array_ptr_segments = 0; string[string][string] node; } - struct ObjComposite { - string use = ""; - string of = ""; - string is_a = ""; - string object = ""; - string obj_cite_number = ""; // not used for calculations? output only? else int - string[] anchor_tags = []; - HeadingAttrib heading_attrib; - ParaAttrib para_attrib; - BlockAttrib block_attrib; - Node node_structure; - } - struct ObjCompositeArr { - ObjComposite[] oca; - } - /+ structs setter +/ - struct ObjectAbstractSet { - import std.conv : to; - auto contents_comment(in string object) { - ObjComposite object_set; - object_set.use = "comment"; - object_set.of = "comment"; - object_set.is_a = "comment"; - object_set.object = object; - return object_set; - } - auto contents_heading( - in string object, - in string[string] _node_heading_str, - in int[string] _node_heading_int, - in string[] tags, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "heading"; - object_set.object = object.strip; - object_set.obj_cite_number = _node_heading_str["ocn"]; - object_set.anchor_tags ~= tags; - object_set.heading_attrib.lev = _node_heading_str["marked_up_lev"]; - object_set.heading_attrib.lev_int_markup = _node_heading_int["heading_lev_markup"]; - object_set.heading_attrib.lev_int_collapsed = _node_heading_int["heading_lev_collapsed"]; - return object_set; - } - auto contents_para( - in string object, - in string[string] _node_para_str, - in int[string] _node_para_int, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "para"; - object_set.object = object.strip; - object_set.obj_cite_number = (_node_para_int["ocn"]==0) ? "" : to!string(_node_para_int["ocn"]); - object_set.anchor_tags = []; - object_set.para_attrib.indent_start = _node_para_int["indent_hang"]; - object_set.para_attrib.indent_rest = _node_para_int["indent_base"]; - object_set.para_attrib.bullet = (_node_para_int["bullet"] == 1) ? true : false; - return object_set; - } - auto contents_toc( - in string is_a, - in string object, - in string attrib, - in int obj_cite_number, - in int[string] indent, - in bool bullet, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "toc"; - object_set.object = object.strip; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.para_attrib.indent_start = to!int(indent["hang_position"]); - object_set.para_attrib.indent_rest = to!int(indent["base_position"]); - object_set.para_attrib.bullet = false; // bullet; - return object_set; - } - auto contents_endnote( - in string object, - in string tag, - ) { - auto m = (matchFirst(object, rgx.note_ref)); - string notenumber = to!string(m.captures[1]); - string anchor_tag = "note_" ~ notenumber; - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "para"; - object_set.is_a = "endnote"; - object_set.object = object.strip; - object_set.obj_cite_number = ""; - object_set.anchor_tags ~= [ tag ]; - object_set.para_attrib.indent_start = 0; - object_set.para_attrib.indent_rest = 0; - object_set.para_attrib.bullet = false; - return object_set; - } - auto contents_block( - in string type_is, - in string object, - in string attrib, - in int obj_cite_number, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; - } - auto contents_block_code( - in string type_is, - in string object, - in string attrib_language_syntax, - in int obj_cite_number, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.block_attrib.syntax = attrib_language_syntax; - object_set.object = object; - object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set.anchor_tags = []; - return object_set; - } - auto contents_block_obj_cite_number_string( - in string type_is, - in string object, - in string obj_cite_number, - in string[string] _node_str, - in int[string] _node_int, - ) { - ObjComposite object_set; - object_set.use = "content"; - object_set.of = "block"; - object_set.is_a = type_is; - object_set.object = object; - object_set.obj_cite_number = obj_cite_number; - return object_set; - } + struct TheObjects { + ObjGenericComposite[] oca; } } |