diff options
| author | Ralph Amissah <ralph@amissah.com> | 2016-04-24 22:50:48 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2016-04-25 22:59:38 -0400 | 
| commit | d90d65ba5b5c2c0854a328a0560b207453389477 (patch) | |
| tree | ad14a2553e5ea0c4ecd6fbe4133fa63fa47ae4f3 /org | |
| parent | step2 (diff) | |
step3
Diffstat (limited to 'org')
| -rw-r--r-- | org/ao_abstract_doc_source.org | 219 | ||||
| -rw-r--r-- | org/ao_output_debugs.org | 60 | ||||
| -rw-r--r-- | org/sdp.org | 7 | 
3 files changed, 155 insertions, 131 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index cf0efd2..cc4fd47 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -49,7 +49,8 @@ mixin InternalMarkup;  /+ initialize +/  auto rgx = Rgx(); -string[string][] contents_the_objects; +ObjComposite[] contents_the_objects; +  string[string] an_object, processing;  auto set_abstract_object = ObjectAbstractSet();  auto set_header = HeaderDocMetadataMakeJson(); @@ -235,7 +236,8 @@ scope(exit) {  }  scope(failure) {    stderr.writefln( -    "%s:%s failed here:\n  line: %s", +    "%s\n%s\n%s:%s failed here:\n  line: %s", +    __MODULE__, __FUNCTION__,      __FILE__, __LINE__,      line,    ); @@ -638,12 +640,11 @@ if ((type["header_make"] == State.on)    ++heading_pointer;    contents_the_objects ~=      set_abstract_object.contents_heading( -      type["obj_cite_number_status"],        an_object["substantive"],        an_object["attrib"], -      obj_cite_number, an_object["lev"], -      an_object["lev_markup_number"], -      an_object["lev_collapsed_number"] +      obj_cite_number, +      to!int(an_object["lev_markup_number"]), +      to!int(an_object["lev_collapsed_number"])      );    // track previous heading and make assertions    debug(objectrelated1) { // check @@ -732,10 +733,10 @@ if ((type["header_make"] == State.on)  #+name: abs_in_loop_body_01  #+BEGIN_SRC d -if (((contents_the_objects[$-1]["is"] == "para") -|| (contents_the_objects[$-1]["is"] == "heading")) +if (((contents_the_objects[$-1].is_a == "para") +|| (contents_the_objects[$-1].is_a == "heading"))  && (counter-1 > previous_count)) { -  if (match(contents_the_objects[$-1]["obj"], +  if (match(contents_the_objects[$-1].object,    rgx.inline_notes_delimiter_al_regular_number_note)) {      // endnotes/ footnotes for      // doc objects other than paragraphs & headings @@ -1805,7 +1806,7 @@ auto table_block(char[] line, ref string[string] an_object, ref int[string] type  auto block_flag_line_empty(    char[] line,    ref string[string] an_object, -  ref string[string][] contents_the_objects, +  ref ObjComposite[] contents_the_objects,    ref string[][string][string] bookindex_unordered_hashes,    ref int obj_cite_number,    ref string node, @@ -3449,7 +3450,6 @@ struct BookIndexReportIndent {  #+name: ao_emitters  #+BEGIN_SRC d  struct BookIndexReportSection { -  mixin ObjectSetter;    int mkn, skn;    auto rgx = Rgx();    auto bookindex_write_section( @@ -3483,7 +3483,6 @@ struct BookIndexReportSection {      int obj_cite_number    ) {      string type; -    int type_heading;      string lev, lev_markup_number, lev_collapsed_number;      string attrib;      string[string] indent; @@ -3491,43 +3490,35 @@ struct BookIndexReportSection {      auto mainkeys =        bookindex_unordered_hashes.byKey.array.sort().release;      string bi_tmp; -    string[string][] bookindex_section; +    ObjComposite[] bookindex_section;      // writeln(mainkeys.length);      // B~ Book Index -    type_heading=1; -    bi_tmp = "Book Index";      attrib="";      lev="B";      lev_markup_number="1";      lev_collapsed_number="1";      bookindex_section ~=        set_abstract_object.contents_heading( -        type_heading, -        bi_tmp, +        "Book Index",          attrib,          obj_cite_number, -        lev, -        lev_markup_number, -        lev_collapsed_number +        to!int(lev_markup_number), +        to!int(lev_collapsed_number)        );      ++obj_cite_number;      ++mkn;      // 1~ Index -    type_heading=1; -    bi_tmp = "Index";      attrib="";      lev="1";      lev_markup_number="4";      lev_collapsed_number="2";      bookindex_section ~=        set_abstract_object.contents_heading( -        type_heading, -        bi_tmp, +        "Index",          attrib,          obj_cite_number, -        lev, -        lev_markup_number, -        lev_collapsed_number +        to!int(lev_markup_number), +        to!int(lev_collapsed_number)        );      ++obj_cite_number;      ++mkn; @@ -3622,31 +3613,30 @@ struct BookIndexReportSection {  #+name: ao_emitters  #+BEGIN_SRC d  struct NotesSection { -  mixin ObjectSetter;    string object_notes;    long previous_count;    int mkn;    auto rgx = Rgx();    private auto gather_notes_for_endnote_section( -    string[string][] contents_am, -    long counter +    ObjComposite[] contents_am, +    ulong counter    )    in {      // endnotes/ footnotes for      // doc objects other than paragraphs & headings      // various forms of grouped text -    assert((contents_am[counter]["is"] == "para") -    || (contents_am[counter]["is"] == "heading")); +    assert((contents_am[counter].is_a == "para") +    || (contents_am[counter].is_a == "heading"));      assert(counter > previous_count);      previous_count=counter;      assert( -      match(contents_am[counter]["obj"], +      match(contents_am[counter].object,        rgx.inline_notes_delimiter_al_regular_number_note)      );    }    body {      foreach(m; -    matchAll(contents_am[counter]["obj"], +    matchAll(contents_am[counter].object,      rgx.inline_notes_delimiter_al_regular_number_note)) {        debug(endnotes_build) {          writeln( @@ -3675,47 +3665,40 @@ struct NotesSection {    }    body {      auto set_abstract_object = ObjectAbstractSet(); -    string[string][] endnotes_section; +    ObjComposite[] endnotes_section;      auto endnotes_ = gathered_notes();      // auto endnotes_ = (split(object_notes, rgx.break_string))[0..$-1];      string type; -    int type_heading;      string lev, lev_markup_number, lev_collapsed_number;      string attrib;      string[string] indent;      // B~ Endnotes -    type_heading=1;      attrib="";      lev="B";      lev_markup_number="1";      lev_collapsed_number="1";      endnotes_section ~=        set_abstract_object.contents_heading( -        type_heading,          "Endnotes",          attrib,          obj_cite_number, -        lev, -        lev_markup_number, -        lev_collapsed_number +        to!int(lev_markup_number), +        to!int(lev_collapsed_number)        );      ++obj_cite_number;      ++mkn;      // 1~ Endnotes -    type_heading=1;      attrib="";      lev="1";      lev_markup_number="4";      lev_collapsed_number="2";      endnotes_section ~=        set_abstract_object.contents_heading( -        type_heading,          "Endnotes",          attrib,          obj_cite_number, -        lev, -        lev_markup_number, -        lev_collapsed_number +        to!int(lev_markup_number), +        to!int(lev_collapsed_number)        );      ++obj_cite_number;      ++mkn; @@ -4293,19 +4276,59 @@ auto assertions_flag_types_block_status_none_or_closed(int[string] type) {  * object setter                                             :abstract:object:  set abstracted objects for downstream processing +** structs                                                           :struct: +#+name: ao_structs +#+BEGIN_SRC d +struct HeadingAttrib { +  int lev                   = 9;   // use of enum should make this redundant, remove +  int lev_markup_number     = 9; +  int lev_collapsed_number  = 9; +} +struct ParaAttrib { +  int indent_first          = 0; +  int indent_second         = 0; +  bool bullet               = false; +} +struct BlockAttrib { +} +struct Comment { +  // no .attrib and no .obj_cite_number +} +struct Node { +  int ocn                    = 0; +  int parent_lev             = 0; +  int parent_ocn             = 0; +  string node                = ""; +} +struct ObjComposite { +  // size_t id; +  string use                 = ""; +  string of                  = ""; +  string is_a                = ""; +  string object              = ""; +  string obj_cite_number     = "";  // not used for calculations? output only? else int +  HeadingAttrib heading_attrib; +  ParaAttrib para_attrib; +  BlockAttrib block_attrib; +  Node node_structure; +} +struct ObjCompositeArr { +  ObjComposite[] oca; +} +#+END_SRC +  ** object setter                                                        :set:  *** comment                                                         :comment:  #+name: ao_object_setter  #+BEGIN_SRC d -string[string] contents_comment(in string object) { -  string[string] object_set; -  object_set["use"]           = "comment"; -  object_set["of"]            = "comment"; -  object_set["is"]            = "comment"; -  object_set["obj"]           = object; -  // object_set["attrib"]     = attrib; +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;  }  #+END_SRC @@ -4314,28 +4337,22 @@ string[string] contents_comment(in string object) {  #+name: ao_object_setter  #+BEGIN_SRC d -string[string] contents_heading( -  in int type, +auto contents_heading(    in string object,    in string attrib,    in int obj_cite_number, -  in string lev, -  in string lev_markup_number, -  in string lev_collapsed_number, +  in int lev_markup_number, +  in int lev_collapsed_number,  ) { -  string[string] object_set; -  object_set["use"]                  = "content"; -  object_set["of"]                   = "para"; -  object_set["is"]                   = "heading"; -  object_set["type"]                 = to!string(type); -  // object_set["is"]                = type; // "heading" "heading_dummy" -  object_set["obj"]                  = object; -  object_set["obj_cite_number"]      = (obj_cite_number==0) ? "" : to!string(obj_cite_number); -  object_set["lev"]                  = to!string(lev); -  object_set["lev_markup_number"]    = to!string(lev_markup_number); -  object_set["lev_collapsed_number"] = to!string(lev_collapsed_number); -  object_set["attrib"]               = attrib; -  // object_set["children"]          = children; +  ObjComposite object_set; +  object_set.use                                 = "content"; +  object_set.of                                  = "para"; +  object_set.is_a                                = "heading"; +  object_set.object                              = object; +  object_set.obj_cite_number                     = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +  object_set.heading_attrib.lev_markup_number    = lev_markup_number; +  object_set.heading_attrib.lev_collapsed_number = lev_collapsed_number; +  // object_set.node_structure.node               = node;    return object_set;  }  #+END_SRC @@ -4344,7 +4361,7 @@ string[string] contents_heading(  #+name: ao_object_setter  #+BEGIN_SRC d -string[string] contents_para( +auto contents_para(    in string is_a,    in string object,    in string attrib, @@ -4352,17 +4369,16 @@ string[string] contents_para(    in string[string] indent,    in bool bullet  ) { -  string[string] object_set; -  object_set["use"]              = "content"; -  object_set["of"]               = "para"; -  object_set["is"]               = is_a; -  // object_set["status"]        = status; -  object_set["obj"]              = object; -  object_set["obj_cite_number"]  = (obj_cite_number==0) ? "" : to!string(obj_cite_number); -  object_set["indent_first"]     = indent["first"]; -  object_set["indent_second"]    = indent["second"]; -  object_set["bullet"]           = to!string(bullet); -  object_set["attrib"]           = attrib; +  ObjComposite object_set; +  object_set.use                 = "content"; +  object_set.of                  = "para"; +  object_set.is_a                = "para"; +  object_set.object              = object; +  object_set.obj_cite_number     = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +  object_set.para_attrib.indent_first   = 0; // indent["first"]; +  object_set.para_attrib.indent_second  = 0; // indent["second"]; +  object_set.para_attrib.bullet         = false; +  // object_set.node_structure.node               = node;    return object_set;  }  #+END_SRC @@ -4371,19 +4387,19 @@ string[string] contents_para(  #+name: ao_object_setter  #+BEGIN_SRC d -string[string] contents_block( +auto contents_block(    in string type,    in string object,    in string attrib,    in int obj_cite_number  ) { -  string[string] object_set; -  object_set["use"]             = "content"; -  object_set["of"]              = "block"; -  object_set["is"]              = type; -  object_set["obj"]             = object; -  object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number); -  object_set["attrib"]          = attrib; +  ObjComposite object_set; +  object_set.use                 = "content"; +  object_set.of                  = "block"; +  object_set.is_a                = type; +  object_set.object              = object; +  object_set.obj_cite_number     = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +  // object_set.node_structure.node               = node;    return object_set;  }  #+END_SRC @@ -4392,20 +4408,19 @@ string[string] contents_block(  #+name: ao_object_setter  #+BEGIN_SRC d -string[string] contents_block_obj_cite_number_string( +auto contents_block_obj_cite_number_string(    in string type,    in string object,    in string obj_cite_number,    in string node  ) { -  string[string] object_set; -  object_set["use"]             = "content"; -  object_set["of"]              = "block"; -  object_set["is"]              = type; -  object_set["obj"]             = object; -  object_set["obj_cite_number"] = obj_cite_number; -  object_set["node"]            = node; -  // object_set["attrib"]       = ""; +  ObjComposite object_set; +  object_set.use                               = "content"; +  object_set.of                                = "block"; +  object_set.is_a                              = type; +  object_set.object                            = object; +  object_set.obj_cite_number                   = obj_cite_number; +  object_set.node_structure.node               = node;    return object_set;  }  #+END_SRC @@ -4482,6 +4497,10 @@ template SiSUdocAbstraction() {    ao_object_setter.d  +/  template ObjectSetter() { +  /+ structs +/ +  <<ao_structs>> + +  /+ structs setter +/    struct ObjectAbstractSet {      import std.conv : to;      <<ao_object_setter>> diff --git a/org/ao_output_debugs.org b/org/ao_output_debugs.org index c5f4482..72ca80e 100644 --- a/org/ao_output_debugs.org +++ b/org/ao_output_debugs.org @@ -24,15 +24,15 @@ debug(parent) {      __LINE__,    );    foreach (obj; contents) { -    if (obj["use"] == "content") { -      if (obj["is"] == "heading") { +    if (obj.use == "content") { +      if (obj.is_a == "heading") {          writefln(            "%s%s node: %s heading: %s %s",            scr_txt_marker["cyan"], -          obj["obj_cite_number"], -          obj["node"], -          obj["lev_markup_number"], -          obj["obj"], +          obj.obj_cite_number, +          obj.node, +          obj.lev_markup_number, +          obj.object,          );        } else {        } @@ -51,12 +51,12 @@ debug(dumpdoc) {      __LINE__,    );    foreach (obj; contents) { -    if (obj["use"] == "content") { +    if (obj.use == "content") {        writefln(          "[%s][%s]\n%s", -        obj["obj_cite_number"], -        obj["is"], -        obj["obj"] +        obj.obj_cite_number, +        obj.is_a, +        obj.object        );      }    } @@ -73,14 +73,14 @@ debug(objects) {      __LINE__,    );    foreach (obj; contents) { -    if (obj["use"] == "content") { +    if (obj.use == "content") {        writefln(          "%s* [%s][%s] %s%s",          scr_txt_color["green"], -        obj["obj_cite_number"], -        obj["is"], +        obj.obj_cite_number, +        obj.is_a,          scr_txt_color["off"], -        obj["obj"] +        obj.object        );      }    } @@ -269,9 +269,9 @@ debug(summary) {  #+BEGIN_SRC d  debug(checkdoc) {    foreach (obj; contents) { -    if (obj["use"] == "content") { -      if (!empty(obj["obj_cite_number"])) { -        check["last_obj_cite_number"] = obj["obj_cite_number"]; +    if (obj.use == "content") { +      if (!empty(obj.obj_cite_number)) { +        check["last_obj_cite_number"] = obj.obj_cite_number;        }      }    } @@ -288,14 +288,14 @@ debug(headings) {      __LINE__,    );    foreach (obj; contents) { -    if (obj["is"] == "heading") { +    if (obj.is_a == "heading") {        writefln(          "%s%s~ [%s] %s",          scr_txt_marker["yellow"], -        obj["lev"], -        obj["obj_cite_number"], +        obj.heading_attrib.lev, +        obj.obj_cite_number,          // "[", obj["is"], "] ", -        obj["obj"] +        obj.object        );      }    } @@ -456,14 +456,18 @@ debug(checkdoc) {  +/  template SiSUoutputDebugs() {    struct SDPoutputDebugs { -    auto abstract_doc_source_debugs( -      string[string][] contents, -      JSONValue[string] docmake, -      JSONValue[string] dochead, +    auto tst_debugs(S)(auto ref const S s) { +      mixin RgxInit; +      mixin ScreenTxtColors; +      auto rgx = Rgx(); +    } +    auto abstract_doc_source_debugs(S)(auto ref const S contents, +      JSONValue[string]        docmake, +      JSONValue[string]        dochead,        string[][string][string] bookindex_unordered_hashes, -      JSONValue[] biblio, -      string fn_src, -      bool[string] opt_action_bool +      JSONValue[]              biblio, +      string                   fn_src, +      bool[string]             opt_action_bool      ) {        mixin RgxInit;        mixin ScreenTxtColors; diff --git a/org/sdp.org b/org/sdp.org index e218b5c..a48fbfa 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -39,7 +39,7 @@ enum ver = Version(1, 0, 0);  [[./ao_output_debugs.org][ao_output_debugs]]  [[./ao_read_source_files.org][ao_read_source_files]] -**** std                                                      :import:std: +**** std                                                         :import:std:  #+NAME: sdp_imports  #+BEGIN_SRC d  /+ sdp  sisu document parser +/ @@ -274,7 +274,8 @@ auto doc_ao_biblio = t[4];  // destroy(t);  #+END_SRC -**** debug document parts (checkdoc)                                  :debug: +**** TODO debug                                                       :debug: +***** [#A] debug document parts (checkdoc)                         :checkdoc:  #+NAME: sdp_each_file_do  #+BEGIN_SRC d  /+ ↓ document parts +/ @@ -424,7 +425,7 @@ void main(string[] args) {  | - metadata          |                                          |                        |        |  | - make instructions |                                          |                        |        |  |---------------------+------------------------------------------+------------------------+--------| -| table of contents   | markup of headings                       |                        | output | +| table of contents   | markup of headings                       | (regular content)      | output |  |---------------------+------------------------------------------+------------------------+--------|  | substantive content | sisu /content markup/                      | markup                 | output |  |                     | headings (providing document structure), | (regular content)      |        |  | 
