diff options
Diffstat (limited to 'org')
| -rw-r--r-- | org/metaverse.org | 186 | 
1 files changed, 89 insertions, 97 deletions
| diff --git a/org/metaverse.org b/org/metaverse.org index f5bfd41..86269bb 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -69,7 +69,7 @@ template docAbstraction() {            } else if (!line.empty) {                                             /+ line not empty +/                                                                                  /+ non blocks (headings, paragraphs) & closed blocks +/              <<abs_in_loop_body_not_block_obj>> -          } else if (pith["block_state"] == eN.tri.closing) {            /+ line empty, with blocks flag +/ +          } else if (pith["block_state"] == eN.blk_state.closing) {             /+ line empty, with blocks flag +/              <<abs_in_loop_body_not_block_obj_line_empty_blocks_flags>>            } else {                                                              /+ line.empty, post contents, empty variables: +/              <<abs_in_loop_body_not_block_obj_line_empty>> @@ -165,17 +165,19 @@ import  mixin ObjectSetter;  mixin InternalMarkup;  mixin spineRgxIn; +#+END_SRC + +*** initialize                                                 :initialize: +**** declare enum + +#+NAME: abs_top_init_struct +#+BEGIN_SRC d  @safe static auto eN() {    struct _e {      enum bi {        off,        on,      } -    enum tri { -      off, -      on, -      closing, -    }      enum ocn {        off,        on, @@ -224,7 +226,6 @@ mixin spineRgxIn;  }  #+END_SRC -*** initialize                                                 :initialize:  **** initialize general  #+NAME: abs_top_init_struct @@ -613,18 +614,18 @@ uint[string] dochas = [    "quote"             : 0,    "images"            : 0,  ]; -auto obj_type_status = flags_type_init; -int[string] pith = [ -  "ocn"                       : 1, -  "section"                   : 0, -  "txt_is"                    : 0, -  "block_is"                  : 0, -  "block_state"               : 0, -  "block_delim"               : 0, -  "obj"                       : 0, -  "dummy_heading_status"      : 0, -  "no_ocn_multiple_objects"   : 0, -  "heading_multiple_objects"  : 0, +uint[string] pith = [ +  "ocn"                            : 1, +  "section"                        : 0, +  "txt_is"                         : 0, +  "block_is"                       : 0, +  "block_state"                    : 0, +  "block_delim"                    : 0, +  "make_headings"                  : 0, +  "dummy_heading_status"           : 0, +  "dummy_heading_multiple_objects" : 0, +  "no_ocn_multiple_objects"        : 0, +  "verse_new"                      : 0,  ];  string[string] object_number_poem = [    "start" : "", @@ -1144,7 +1145,7 @@ if there is a blurb section you need to:  #+NAME: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d    } else if (pith["block_is"]    == eN.blk_is.poem) { -    an_object = line.flow_txt_block_poem(an_object, obj_type_status, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); +    an_object = line.flow_txt_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);      continue;  #+END_SRC @@ -1153,7 +1154,7 @@ if there is a blurb section you need to:  #+NAME: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d    } else if (pith["block_is"]    == eN.blk_is.table) { -    an_object = line.flow_txt_block_table(an_object, obj_type_status, pith, conf_make_meta); +    an_object = line.flow_txt_block_table(an_object, pith, conf_make_meta);      continue;    }  #+END_SRC @@ -1179,7 +1180,7 @@ if (line.matchFirst(rgx.block_poem_open)) {                                    /    processing.remove("verse");    object_number_poem["start"] = obj_cite_digits.object_number.to!string;  } -line.flow_txt_block_start(obj_type_status, pith, dochas, object_number_poem); +line.flow_txt_block_start(pith, dochas, object_number_poem);  continue;  #+END_SRC @@ -1194,7 +1195,7 @@ assert(  );  assert(    (pith["block_state"] == eN.blk_state.off) -  || (pith["block_state"] == eN.tri.closing), +  || (pith["block_state"] == eN.blk_state.closing),    "code block status: none or closed"  );  if (pith["block_state"] == eN.blk_state.closing) { @@ -1260,15 +1261,15 @@ if (line.matchFirst(rgx.book_index_item)      && pith["txt_is"] == eN.txt_is.off    ) {                             /+ heading or para but neither flag nor line exists +/      if ((conf_make_meta.make.headings.length > 2) -    && (obj_type_status["make_headings"] == eN.bi.off)) {                      /+ heading found +/ -      heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, obj_type_status, pith); +    && (pith["make_headings"] == eN.bi.off)) {                      /+ heading found +/ +      heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith);      } -    if (obj_type_status["make_headings"] == eN.bi.on +    if (pith["make_headings"] == eN.bi.on        && (line_occur["para"] == eN.bi.off        && line_occur["heading"] == eN.bi.off)        && pith["txt_is"] == eN.txt_is.off      ) {                           /+ heading make set +/ -      line = line.flow_heading_make_set_(line_occur, heading_match_rgx, obj_type_status, pith); +      line = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith);      }      /+ TODO node info: all headings identified at this point,         - extract node info here?? @@ -1284,7 +1285,6 @@ if (line.matchFirst(rgx.book_index_item)          an_object_key,          lv,          collapsed_lev, -        obj_type_status,          pith,          conf_make_meta,        ); @@ -3199,7 +3199,7 @@ functions used in document abstraction  @system void flow_common_reset_()(    return ref int[string]     line_occur,    return ref string[string]  an_object, -  return ref int[string]     pith, +  return ref uint[string]    pith,  ) {    line_occur["heading"]      = eN.bi.off;    line_occur["para"]         = eN.bi.off; @@ -3212,33 +3212,33 @@ functions used in document abstraction  #+NAME: abs_functions_ocn_status  #+BEGIN_SRC d -@safe static int[string] _check_ocn_status_()( +@safe static uint[string] _check_ocn_status_()(    char[]       line, -  int[string]  pith, +  uint[string] pith,  ) {    static auto rgx = RgxI();    if (!(line.empty)) { -    if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +    if (pith["no_ocn_multiple_objects"] == eN.bi.off) {        /+ not multi-line object, check whether object_number is on or turned off +/        if (line.matchFirst(rgx.object_number_block_marks)) {                      /+ switch off object_number +/          if (line.matchFirst(rgx.object_number_off_block)) { -          pith["no_ocn_multiple_objects"] = eN.ocn.on; -          pith["ocn"] = eN.ocn.off; +          pith["no_ocn_multiple_objects"]             = eN.bi.on; +          pith["ocn"]                                 = eN.ocn.off;            debug(ocnoff) {              writeln(line);            }          }          if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { -          pith["no_ocn_multiple_objects"]  = eN.ocn.on; -          pith["heading_multiple_objects"] = eN.bi.on; -          pith["ocn"]                      = eN.ocn.off; +          pith["no_ocn_multiple_objects"]             = eN.bi.on; +          pith["dummy_heading_multiple_objects"]      = eN.bi.on; +          pith["ocn"]                                 = eN.ocn.off;            debug(ocnoff) {              writeln(line);            }          } -      } else if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +      } else if (pith["no_ocn_multiple_objects"] == eN.bi.off) {            pith["dummy_heading_status"]     = eN.bi.off; -          if (pith["heading_multiple_objects"]) { +          if (pith["dummy_heading_multiple_objects"]) {              pith["dummy_heading_status"] = eN.bi.on;            }            if (line.matchFirst(rgx.object_number_off)) { @@ -3253,9 +3253,9 @@ functions used in document abstraction          } else {            pith["ocn"] = pith["no_ocn_multiple_objects"];          } -    } else if (pith["no_ocn_multiple_objects"] == eN.ocn.on) { +    } else if (pith["no_ocn_multiple_objects"] == eN.bi.on) {        if (line.matchFirst(rgx.object_number_off_block_close)) { -        pith["no_ocn_multiple_objects"]    = eN.ocn.off; +        pith["no_ocn_multiple_objects"]    = eN.bi.off;          pith["ocn"]                        = eN.ocn.on;          pith["dummy_heading_status"]       = eN.bi.off;          debug(ocnoff) { @@ -3329,8 +3329,7 @@ functions used in document abstraction  #+BEGIN_SRC d  @safe void flow_txt_block_start()(               char[]         line, -  return ref int[string]    obj_type_status, -  return ref int[string]    pith, +  return ref uint[string]   pith,    return ref uint[string]   dochas,    return ref string[string] object_number_poem  ) { @@ -3382,7 +3381,7 @@ functions used in document abstraction      pith["block_is"]       = eN.blk_is.poem;      pith["block_state"]    = eN.blk_state.on;      pith["block_delim"]    = eN.blk_delim.curly; -    obj_type_status["verse_new"]  = eN.bi.on; +    pith["verse_new"]  = eN.bi.on;  #+END_SRC  ******* group @@ -3414,7 +3413,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = (m["attrib"]) ? m["attrib"].to!string : "";      an_object["lang"]              = (m["lang"]) ? m["lang"].to!string : ""; -    debug(block) {                             // block (curly) open +    debug(block) {        writefln(          "* [block curly] %s",          line @@ -3434,7 +3433,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = m["attrib"].to!string;      an_object["lang"]              = m["lang"].to!string; -    debug(quote) {                             // quote (curly) open +    debug(quote) {        writefln(          "* [quote curly] %s",          line @@ -3487,7 +3486,7 @@ functions used in document abstraction      an_object["lang"]              = "";      an_object["attrib"]            = (m["attrib"]) ? m["attrib"].to!string : "";      an_object["syntax"]            = (m["syntax"]) ? m["syntax"].to!string : ""; -    debug(codetic) {                              // code (tic) open +    debug(codetic) {        writefln(          "* [code tic] %s",          line @@ -3507,7 +3506,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = (m["attrib"]) ? m["attrib"].to!string : "";      an_object["lang"]              = (m["lang"]) ? m["lang"].to!string : ""; -    debug(poem) {                              // poem (tic) open +    debug(poem) {        writefln(          "* [poem tic] %s",          line @@ -3517,7 +3516,7 @@ functions used in document abstraction      pith["block_is"]       = eN.blk_is.poem;      pith["block_state"]    = eN.blk_state.on;      pith["block_delim"]    = eN.blk_delim.tic; -    obj_type_status["verse_new"]  = eN.bi.on; +    pith["verse_new"]  = eN.bi.on;  #+END_SRC  ******* group @@ -3529,7 +3528,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = (m["attrib"]) ? m["attrib"].to!string : "";      an_object["lang"]              = (m["lang"]) ? m["lang"].to!string : ""; -    debug(group) {                             // group (tic) open +    debug(group) {        writefln(          "* [group tic] %s",          line @@ -3549,7 +3548,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = (m["attrib"]) ? m["attrib"].to!string : "";      an_object["lang"]              = (m["lang"]) ? m["lang"].to!string : ""; -    debug(block) {                             // block (tic) open +    debug(block) {        writefln(          "* [block tic] %s",          line @@ -3569,7 +3568,7 @@ functions used in document abstraction      an_object["syntax"]            = "";      an_object["attrib"]            = m["attrib"].to!string;      an_object["lang"]              = m["lang"].to!string; -    debug(quote) {                             // quote (tic) open +    debug(quote) {        writefln(          "* [quote tic] %s",          line @@ -3615,7 +3614,7 @@ functions used in document abstraction  @safe void flow_txt_block_code()(               char[]          line,    return ref string[string]  an_object, -  return ref int[string]     pith, +  return ref uint[string]    pith,  ) {    static auto rgx = RgxI();    if ( pith["block_is"] == eN.blk_is.code) { @@ -3716,11 +3715,11 @@ final string biblio_tag_map_()(string abr) {  #+NAME: abs_functions_block_biblio  #+BEGIN_SRC d  @system void flow_txt_block_biblio( -  char[]                 line, -  return ref int[string] pith, -  return ref int         bib_entry, -  return ref string      biblio_entry_str_json, -  return ref string[]    biblio_arr_json, +  char[]                  line, +  return ref uint[string] pith, +  return ref int          bib_entry, +  return ref string       biblio_entry_str_json, +  return ref string[]     biblio_arr_json,  ) {    mixin spineBiblio;    auto jsn = BibJsnStr(); @@ -3754,7 +3753,7 @@ final string biblio_tag_map_()(string abr) {          }          biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr;        } -    } else { // CHECK ERROR +    } else {        writeln("?? 2. ERROR ", biblio_entry_str_json, "??");        biblio_entry_str_json = "";      } @@ -3844,7 +3843,7 @@ final string biblio_tag_map_()(string abr) {  @safe string[string] flow_txt_block_quote()(               char[]          line,               string[string]  an_object, -  return ref int[string]     pith, +  return ref uint[string]    pith,  ) {    static auto rgx = RgxI();    if (pith["block_is"] == eN.blk_is.quote){ @@ -3894,7 +3893,7 @@ final string biblio_tag_map_()(string abr) {  @safe string[string] flow_txt_block_group()(               char[]          line,               string[string]  an_object, -  return ref int[string]     pith, +  return ref uint[string]    pith,  ) {    static auto rgx = RgxI();    if (pith["block_is"] == eN.blk_is.group) { @@ -3945,7 +3944,7 @@ final string biblio_tag_map_()(string abr) {  @safe string[string] flow_txt_block_block()(               char[]          line,               string[string]  an_object, -  return ref int[string]     pith, +  return ref uint[string]    pith,  ) {    static auto rgx = RgxI();    if (pith["block_is"] == eN.blk_is.block) { @@ -3994,8 +3993,7 @@ why extra object stuff only in poem/verse?  @safe string[string]  flow_txt_block_poem(CMM)(               char[]          line,               string[string]  an_object, -  return ref int[string]     obj_type_status, -  return ref int[string]     pith, +  return ref uint[string]    pith,    return ref int             cntr,               string[string]  object_number_poem,               CMM             conf_make_meta, @@ -4066,15 +4064,15 @@ why extra object stuff only in poem/verse?          pith["block_delim"] = eN.blk_delim.off;        } else {          processing["verse"] ~= line ~= "\n"; -        if (obj_type_status["verse_new"] == eN.bi.on) { +        if (pith["verse_new"] == eN.bi.on) {            obj_cite_digits = ocn_emit(pith["ocn"]); -          obj_type_status["verse_new"] = eN.bi.off; +          pith["verse_new"] = eN.bi.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {            processing["verse"] = processing["verse"].stripRight; -          verse_line = eN.tri.off; -          obj_type_status["verse_new"] = eN.bi.on; +          verse_line = eN.bi.off; +          pith["verse_new"] = eN.bi.on;          } -        if (obj_type_status["verse_new"] == eN.bi.on) { +        if (pith["verse_new"] == eN.bi.on) {            verse_line=1;            an_object[an_object_key] = processing["verse"];            debug(poem) { @@ -4174,15 +4172,15 @@ why extra object stuff only in poem/verse?          pith["block_delim"] = eN.blk_delim.off;        } else {          processing["verse"] ~= line ~= "\n"; -        if (obj_type_status["verse_new"] == eN.bi.on) { +        if (pith["verse_new"] == eN.bi.on) {            obj_cite_digits = ocn_emit(pith["ocn"]); -          obj_type_status["verse_new"] = eN.bi.off; +          pith["verse_new"] = eN.bi.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {            processing["verse"] = processing["verse"].stripRight; -          obj_type_status["verse_new"] = eN.bi.on; -          verse_line = eN.tri.off; +          pith["verse_new"] = eN.bi.on; +          verse_line = eN.bi.off;          } -        if (obj_type_status["verse_new"] == eN.bi.on) { +        if (pith["verse_new"] == eN.bi.on) {            verse_line=1;            an_object[an_object_key] = processing["verse"];            debug(poem) { @@ -4261,8 +4259,7 @@ you need:  @system string[string] flow_txt_block_table(CMM)(               char[]          line,               string[string]  an_object, -  return ref int[string]     obj_type_status, -  return ref int[string]     pith, +  return ref uint[string]    pith,    return ref CMM             conf_make_meta,  ) {    static auto rgx = RgxI(); @@ -4338,7 +4335,7 @@ process and use an_object["table_head"] (then empty it)    return ref N                     obj_cite_digits,    return ref ObjGenericComposite   _comp_obj_heading,    return ref int                   cntr, -  return ref int[string]           pith, +  return ref uint[string]          pith,    CMM                              conf_make_meta  ) {    comp_obj_block = comp_obj_block.init; @@ -4389,7 +4386,7 @@ process and use an_object["table_head"] (then empty it)    return ref N                        obj_cite_digits,    return ref ObjGenericComposite      _comp_obj_heading,    return ref int                      cntr, -  return ref int[string]              pith, +  return ref uint[string]             pith,    string[string]                      object_number_poem,    CMM                                 conf_make_meta,    Ts                                  tag_in_seg, @@ -4749,7 +4746,7 @@ process and use an_object["table_head"] (then empty it)               char[]          line,               string[string]  an_object,    return ref string          book_idx_tmp, -  return ref int[string]     pith, +  return ref uint[string]    pith,               B               opt_action,  ) {    static auto rgx = RgxI(); @@ -4807,12 +4804,11 @@ process and use an_object["table_head"] (then empty it)               string[string]        heading_match_str,               string[]              _make_unmarked_headings,    return ref Regex!(char)[string]  heading_match_rgx, -  return ref int[string]           obj_type_status, -  return ref int[string]           pith, +  return ref uint[string]          pith,  ) {    static auto rgx = RgxI();    if ((_make_unmarked_headings.length > 2) -  && (obj_type_status["make_headings"] == eN.bi.off)) {                        /+ headings found +/ +  && (pith["make_headings"] == eN.bi.off)) {                        /+ headings found +/      debug(headingsfound) {        writeln(_make_unmarked_headings);      } @@ -4880,7 +4876,7 @@ process and use an_object["table_head"] (then empty it)      default:        break;      } -    obj_type_status["make_headings"] = eN.bi.on; +    pith["make_headings"] = eN.bi.on;    }    return heading_match_str;  } @@ -4894,10 +4890,9 @@ process and use an_object["table_head"] (then empty it)               char[]                line,               int[string]           line_occur,    return ref Regex!(char)[string]  heading_match_rgx, -  return ref int[string]           obj_type_status, -  return ref int[string]           pith, +  return ref uint[string]          pith,  ) { -  if (obj_type_status["make_headings"] == eN.bi.on +  if (pith["make_headings"] == eN.bi.on      && (line_occur["para"] == eN.bi.off      && line_occur["heading"] == eN.bi.off)      && pith["txt_is"] == eN.txt_is.off @@ -4960,8 +4955,7 @@ process and use an_object["table_head"] (then empty it)    return ref string          an_object_key,    return ref int[string]     lv,    return ref int[string]     collapsed_lev, -  return ref int[string]     obj_type_status, -  return ref int[string]     pith, +  return ref uint[string]    pith,    return ref CMM             conf_make_meta,  ) {    static auto rgx = RgxI(); @@ -5116,7 +5110,7 @@ process and use an_object["table_head"] (then empty it)    return ref string          an_object_key,    return ref int[string]     indent,    return ref bool            bullet, -  return ref int[string]     pith, +  return ref uint[string]    pith,    return ref int[string]     line_occur,  ) {    static auto rgx = RgxI(); @@ -5890,8 +5884,8 @@ static struct ObjInlineMarkup {        if (_new_doc) {          anchor_tag = "";        } -      obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta, _new_doc); -      obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc); +      obj_txt["munge"] = _configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta, _new_doc); +      obj_txt["munge"] = _make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc);        if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) {          anchor_tag = m.captures[1];        } else if (obj_["lev"] == "1") { @@ -6516,10 +6510,8 @@ struct ObjAttributes {        oa_j.object["object_number"]          = _comp_obj_heading.metainfo.ocn;        oa_j.object["lev_markup_number"]      = _comp_obj_heading.metainfo.heading_lev_markup;        oa_j.object["lev_collapsed_number"]   = _comp_obj_heading.metainfo.heading_lev_collapsed; -      oa_j.object["heading_ptr"] -        = _comp_obj_heading.ptr.heading; -      oa_j.object["doc_object_ptr"] -        = _comp_obj_heading.ptr.doc_object; +      oa_j.object["heading_ptr"]            = _comp_obj_heading.ptr.heading; +      oa_j.object["doc_object_ptr"]         = _comp_obj_heading.ptr.doc_object;      }      oa_j.object["parent_object_number"]     = _comp_obj_heading.metainfo.parent_ocn;      oa_j.object["parent_lev_markup_number"] = _comp_obj_heading.metainfo.parent_lev_markup; @@ -6576,7 +6568,7 @@ struct BookIndexNuggetHash {          ) {            main_term = m.captures[1].strip;            object_number_offset = m.captures[2].to!int; -          object_number_endpoint=(obj_cite_digits.object_number + object_number_offset); +          object_number_endpoint = (obj_cite_digits.object_number + object_number_offset);            object_numbers ~= (obj_cite_digits.object_number.to!string            ~ "-" ~ object_number_endpoint.to!string);          } else { @@ -6594,7 +6586,7 @@ struct BookIndexNuggetHash {              if (auto m = sub_terms_bits.match(rgx.bi_term_and_object_numbers_match)) {                sub_term = m.captures[1].strip;                object_number_offset = m.captures[2].to!int; -              object_number_endpoint=(obj_cite_digits.object_number + object_number_offset); +              object_number_endpoint = (obj_cite_digits.object_number + object_number_offset);                object_numbers ~= (obj_cite_digits.object_number.to!string                ~ " - " ~ object_number_endpoint.to!string);              } else { | 
