From 7d1cc45d0c3ac8f3258a022d7dd153c10d292c2d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 11 Nov 2016 15:23:16 -0500 Subject: para attribute: indent, variable type change, check consequences --- org/ao_abstract_doc_source.org | 70 ++++++++++++++++++++-------------------- src/sdp/ao_abstract_doc_source.d | 68 +++++++++++++++++++------------------- src/sdp/ao_object_setter.d | 2 +- 3 files changed, 70 insertions(+), 70 deletions(-) diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 0de77a2..6bdd46b 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -79,7 +79,7 @@ long counter, previous_count; int[string] line_occur; int verse_line, heading_pointer; /+ paragraph attributes +/ -string[string] indent; +int[string] indent; bool bullet = true; string content_non_header = "8"; auto obj_im = ObjInlineMarkup(); @@ -302,8 +302,8 @@ if there is a glossary section you need to: type["biblio_section"] = State.off; type["blurb_section"] = State.off; indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; type["para"] = State.on; @@ -373,8 +373,8 @@ if there is a blurb section you need to: type["biblio_section"] = State.off; type["blurb_section"] = State.on; indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; type["para"] = State.on; @@ -781,8 +781,8 @@ if ((type["heading"] == State.on) ); _common_reset_(line_occur, an_object, type); indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; processing.remove("verse"); @@ -1009,7 +1009,7 @@ foreach (entry; biblio_ordered) { out_, // nugget/object "", // attrib 0, // obj_cite_number - ([ "hang_position" : "0", "base_position" : "1", ]), // indent + ([ "hang_position" : 0, "base_position" : 1, ]), // indent false ); } @@ -2581,7 +2581,7 @@ auto _para_match_( char[] line, ref string[string] an_object, ref string an_object_key, - ref string[string] indent, + ref int[string] indent, ref bool bullet, ref int[string] type, ref int[string] line_occur, @@ -2591,16 +2591,16 @@ auto _para_match_( type["para"] = State.on; an_object[an_object_key] ~= line; // body_nugget indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; if (auto m = matchFirst(line, rgx.para_indent)) { debug(paraindent) { // para indent writeln(line); } - indent["hang_position"] = to!string(m.captures[1]); - indent["base_position"] = "0"; + indent["hang_position"] = to!int(m.captures[1]); + indent["base_position"] = 0; } else if (matchFirst(line, rgx.para_bullet)) { debug(parabullet) { // para bullet writeln(line); @@ -2611,16 +2611,16 @@ auto _para_match_( writeln(line); } indent=[ - "hang_position" : to!string(m.captures[1]), - "base_position" : to!string(m.captures[2]), + "hang_position" : to!int(m.captures[1]), + "base_position" : to!int(m.captures[2]), ]; } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) { debug(parabulletindent) { // para bullet indent writeln(line); } indent=[ - "hang_position" : to!string(m.captures[1]), - "base_position" : "0", + "hang_position" : to!int(m.captures[1]), + "base_position" : 0, ]; bullet = true; } @@ -2927,7 +2927,7 @@ struct ObjInlineMarkup { heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_; - string[string] indent; + int[string] indent; auto set_abstract_object = ObjectAbstractSet(); if (to!int(obj_["lev_markup_number"]) > 0) { toc_txt_ = format( @@ -2936,8 +2936,8 @@ struct ObjInlineMarkup { obj_cite_number, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; toc_txt_ = format( "{ %s }#%s", @@ -2955,8 +2955,8 @@ struct ObjInlineMarkup { ); } else { indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( @@ -2971,8 +2971,8 @@ struct ObjInlineMarkup { switch (to!int(obj_["lev_markup_number"])) { case 0: indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -2986,8 +2986,8 @@ struct ObjInlineMarkup { break; case 1: .. case 3: indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; toc_txt_ = format( "%s", @@ -3010,8 +3010,8 @@ struct ObjInlineMarkup { segment_object_belongs_to, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -3031,8 +3031,8 @@ struct ObjInlineMarkup { obj_cite_number, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -3725,7 +3725,7 @@ struct BookIndexReportSection { string lev; int lev_markup_number, lev_collapsed_number; string attrib; - string[string] indent; + int[string] indent; auto set_abstract_object = ObjectAbstractSet(); auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; @@ -3819,8 +3819,8 @@ struct BookIndexReportSection { type="para"; attrib=""; indent=[ - "hang_position" : "0", - "base_position" : "1", + "hang_position" : 0, + "base_position" : 1, ]; bookindex_section["scroll"] ~= set_abstract_object.contents_para( @@ -3970,7 +3970,7 @@ struct NotesSection { string type; string lev, lev_markup_number, lev_collapsed_number; string attrib; - string[string] indent; + int[string] indent; if (endnotes_["seg"].length > 0) { attrib=""; lev="B"; @@ -4779,7 +4779,7 @@ auto contents_para( in string object, in string attrib, in int obj_cite_number, - in string[string] indent, + in int[string] indent, in bool bullet ) { ObjComposite object_set; diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 2d10585..1429a97 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -52,7 +52,7 @@ template SiSUdocAbstraction() { int[string] line_occur; int verse_line, heading_pointer; /+ paragraph attributes +/ - string[string] indent; + int[string] indent; bool bullet = true; string content_non_header = "8"; auto obj_im = ObjInlineMarkup(); @@ -237,8 +237,8 @@ template SiSUdocAbstraction() { type["biblio_section"] = State.off; type["blurb_section"] = State.off; indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; type["para"] = State.on; @@ -295,8 +295,8 @@ template SiSUdocAbstraction() { type["biblio_section"] = State.off; type["blurb_section"] = State.on; indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; type["para"] = State.on; @@ -600,8 +600,8 @@ template SiSUdocAbstraction() { ); _common_reset_(line_occur, an_object, type); indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; processing.remove("verse"); @@ -777,7 +777,7 @@ template SiSUdocAbstraction() { out_, // nugget/object "", // attrib 0, // obj_cite_number - ([ "hang_position" : "0", "base_position" : "1", ]), // indent + ([ "hang_position" : 0, "base_position" : 1, ]), // indent false ); } @@ -2094,7 +2094,7 @@ template SiSUdocAbstraction() { char[] line, ref string[string] an_object, ref string an_object_key, - ref string[string] indent, + ref int[string] indent, ref bool bullet, ref int[string] type, ref int[string] line_occur, @@ -2104,16 +2104,16 @@ template SiSUdocAbstraction() { type["para"] = State.on; an_object[an_object_key] ~= line; // body_nugget indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; bullet = false; if (auto m = matchFirst(line, rgx.para_indent)) { debug(paraindent) { // para indent writeln(line); } - indent["hang_position"] = to!string(m.captures[1]); - indent["base_position"] = "0"; + indent["hang_position"] = to!int(m.captures[1]); + indent["base_position"] = 0; } else if (matchFirst(line, rgx.para_bullet)) { debug(parabullet) { // para bullet writeln(line); @@ -2124,16 +2124,16 @@ template SiSUdocAbstraction() { writeln(line); } indent=[ - "hang_position" : to!string(m.captures[1]), - "base_position" : to!string(m.captures[2]), + "hang_position" : to!int(m.captures[1]), + "base_position" : to!int(m.captures[2]), ]; } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) { debug(parabulletindent) { // para bullet indent writeln(line); } indent=[ - "hang_position" : to!string(m.captures[1]), - "base_position" : "0", + "hang_position" : to!int(m.captures[1]), + "base_position" : 0, ]; bullet = true; } @@ -2409,7 +2409,7 @@ template SiSUdocAbstraction() { heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; string toc_txt_; - string[string] indent; + int[string] indent; auto set_abstract_object = ObjectAbstractSet(); if (to!int(obj_["lev_markup_number"]) > 0) { toc_txt_ = format( @@ -2418,8 +2418,8 @@ template SiSUdocAbstraction() { obj_cite_number, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; toc_txt_ = format( "{ %s }#%s", @@ -2437,8 +2437,8 @@ template SiSUdocAbstraction() { ); } else { indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( @@ -2453,8 +2453,8 @@ template SiSUdocAbstraction() { switch (to!int(obj_["lev_markup_number"])) { case 0: indent=[ - "hang_position" : "0", - "base_position" : "0", + "hang_position" : 0, + "base_position" : 0, ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -2468,8 +2468,8 @@ template SiSUdocAbstraction() { break; case 1: .. case 3: indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; toc_txt_ = format( "%s", @@ -2492,8 +2492,8 @@ template SiSUdocAbstraction() { segment_object_belongs_to, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -2513,8 +2513,8 @@ template SiSUdocAbstraction() { obj_cite_number, ); indent=[ - "hang_position" : obj_["lev_markup_number"], - "base_position" : obj_["lev_markup_number"], + "hang_position" : to!int(obj_["lev_markup_number"]), + "base_position" : to!int(obj_["lev_markup_number"]), ]; the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( @@ -3048,7 +3048,7 @@ template SiSUdocAbstraction() { string lev; int lev_markup_number, lev_collapsed_number; string attrib; - string[string] indent; + int[string] indent; auto set_abstract_object = ObjectAbstractSet(); auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; @@ -3142,8 +3142,8 @@ template SiSUdocAbstraction() { type="para"; attrib=""; indent=[ - "hang_position" : "0", - "base_position" : "1", + "hang_position" : 0, + "base_position" : 1, ]; bookindex_section["scroll"] ~= set_abstract_object.contents_para( @@ -3263,7 +3263,7 @@ template SiSUdocAbstraction() { string type; string lev, lev_markup_number, lev_collapsed_number; string attrib; - string[string] indent; + int[string] indent; if (endnotes_["seg"].length > 0) { attrib=""; lev="B"; diff --git a/src/sdp/ao_object_setter.d b/src/sdp/ao_object_setter.d index 4d31d8d..c48ddc0 100644 --- a/src/sdp/ao_object_setter.d +++ b/src/sdp/ao_object_setter.d @@ -80,7 +80,7 @@ template ObjectSetter() { in string object, in string attrib, in int obj_cite_number, - in string[string] indent, + in int[string] indent, in bool bullet ) { ObjComposite object_set; -- cgit v1.2.3