From 0245c394af1a4a1400f87916bd10c398005f40da Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 14 Jun 2016 22:52:15 -0400 Subject: step4 some additional work --- src/sdp/ao_abstract_doc_source.d | 219 ++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 108 deletions(-) (limited to 'src/sdp/ao_abstract_doc_source.d') diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index c1566d2..7539755 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -136,7 +136,7 @@ template SiSUdocAbstraction() { } auto type = flags_type_init; auto dochead_make = parseJSON(header_make_jsonstr).object; - auto dochead_metadata = parseJSON(header_metadata_jsonstr).object; + auto dochead_meta = parseJSON(header_metadata_jsonstr).object; mixin ScreenTxtColors; int tell_lo(string color, int obj_cite_number, in char[] line) { writefln( @@ -242,12 +242,12 @@ template SiSUdocAbstraction() { /+ block object: code +/ code_block(line, an_object, type); continue; - } else if (!match(line, rgx.regular_parse_skip)) { + } else if (!matchFirst(line, rgx.regular_parse_skip)) { /+ object other than code block object (includes regular text paragraph) +/ - if (((match(line, rgx.heading_biblio) + if (((matchFirst(line, rgx.heading_biblio) || (type["heading_biblio"] == State.on))) - && (!match(line, rgx.heading)) - && (!match(line, rgx.comment))) { + && (!matchFirst(line, rgx.heading)) + && (!matchFirst(line, rgx.comment))) { /+ within block object: biblio +/ biblio_block(line, type, bib_entry, biblio_arr_json); continue; @@ -273,15 +273,15 @@ template SiSUdocAbstraction() { table_block(line, an_object, type); continue; } else { - /+ not within a block group +/ + /+ not within a block group +/ assert( (type["blocks"] == TriState.off) || (type["blocks"] == TriState.closing), "block status: none or closed" ); assertions_flag_types_block_status_none_or_closed(type); - if (match(line, rgx.block_open)) { - if (match(line, (rgx.block_poem_open))) { + if (matchFirst(line, rgx.block_open)) { + if (matchFirst(line, (rgx.block_poem_open))) { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); @@ -308,19 +308,19 @@ template SiSUdocAbstraction() { tell_l("red", line); } assert( - match(line, rgx.book_index) - || match(line, rgx.book_index_open) + matchFirst(line, rgx.book_index) + || matchFirst(line, rgx.book_index_open) || type["book_index"] == State.on ); } - if ((match(line, rgx.book_index)) - || (match(line, rgx.book_index_open)) + if ((matchFirst(line, rgx.book_index)) + || (matchFirst(line, rgx.book_index_open)) || (type["book_index"] == State.on )) { /+ book_index +/ book_index(line, book_idx_tmp, an_object, type); } else { /+ not book_index +/ - if (auto m = match(line, rgx.comment)) { + if (auto m = matchFirst(line, rgx.comment)) { /+ matched comment +/ debug(comment) { tell_l("blue", line); @@ -333,8 +333,8 @@ template SiSUdocAbstraction() { type["header_make"] = State.off; type["header_metadata"] = State.off; ++counter; - } else if ((match(line, rgx.header_make)) - || (match(line, rgx.header_metadata)) + } else if ((matchFirst(line, rgx.header_make)) + || (matchFirst(line, rgx.header_metadata)) || (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) || (type["header_metadata"] == State.on @@ -360,9 +360,9 @@ template SiSUdocAbstraction() { /+ heading make set +/ heading_make_set(line, line_occur, heading_match_rgx, type); } - if (auto m = match(line, rgx.heading)) { + if (matchFirst(line, rgx.heading)) { /+ heading match +/ - heading_match(line, line_occur, an_object, lv, collapsed_lev, type); + heading_match(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta); } else if (line_occur["para"] == State.off) { /+ para match +/ para_match(line, an_object, indent, bullet, type); @@ -417,9 +417,9 @@ template SiSUdocAbstraction() { && (line_occur["header_make"] > State.off)) { /+ header_make instructions (current line empty) +/ auto dochead_metadata_and_make = - set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make); + set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make); static assert(!isTypeTuple!(dochead_metadata_and_make)); - dochead_metadata = dochead_metadata_and_make[0]; + dochead_meta = dochead_metadata_and_make[0]; dochead_make = dochead_metadata_and_make[1]; header_set_common(line_occur, an_object, type); processing.remove("verse"); @@ -427,9 +427,9 @@ template SiSUdocAbstraction() { && (line_occur["header_metadata"] > State.off)) { /+ header_metadata (current line empty) +/ auto dochead_metadata_and_make = - set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make); - static assert(!isTypeTuple!(dochead_metadata_and_make)); - dochead_metadata = dochead_metadata_and_make[0]; + set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make); + static assert(!isTypeTuple!(dochead_meta)); + dochead_meta = dochead_metadata_and_make[0]; dochead_make = dochead_metadata_and_make[1]; header_set_common(line_occur, an_object, type); type["header_make"] = State.off; @@ -684,7 +684,7 @@ template SiSUdocAbstraction() { tuple( document_the, dochead_make, - dochead_metadata, + dochead_meta, bookindex_unordered_hashes, biblio_ordered ); @@ -721,15 +721,15 @@ template SiSUdocAbstraction() { auto check_obj_cite_number_status(char[] line, ref int[string] type) { if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ - if (match(line, rgx.obj_cite_number_block_marks)) { + if (matchFirst(line, rgx.obj_cite_number_block_marks)) { /+ switch off obj_cite_number +/ - if (match(line, rgx.obj_cite_number_off_block)) { + if (matchFirst(line, rgx.obj_cite_number_off_block)) { type["obj_cite_number_status_multi_obj"] = TriState.on; debug(ocnoff) { tell_l("fuchsia", line); } } - if (match(line, rgx.obj_cite_number_off_block_dh)) { + if (matchFirst(line, rgx.obj_cite_number_off_block_dh)) { type["obj_cite_number_status_multi_obj"] = TriState.closing; debug(ocnoff) { tell_l("fuchsia", line); @@ -737,9 +737,9 @@ template SiSUdocAbstraction() { } } else { if (type["obj_cite_number_status_multi_obj"] == TriState.off) { - if (match(line, rgx.obj_cite_number_off)) { + if (matchFirst(line, rgx.obj_cite_number_off)) { type["obj_cite_number_status"] = TriState.on; - } else if (match(line, rgx.obj_cite_number_off_dh)) { + } else if (matchFirst(line, rgx.obj_cite_number_off_dh)) { type["obj_cite_number_status"] = TriState.closing; } else { // type["obj_cite_number_status"] = TriState.closing; @@ -751,7 +751,7 @@ template SiSUdocAbstraction() { } } } else if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] > TriState.off)) { - if (auto m = match(line, rgx.obj_cite_number_off_block_close)) { + if (matchFirst(line, rgx.obj_cite_number_off_block_close)) { type["obj_cite_number_status_multi_obj"] = TriState.off; type["obj_cite_number_status"] = TriState.off; debug(ocnoff) { @@ -766,7 +766,7 @@ template SiSUdocAbstraction() { ref int[string] type, string[string] obj_cite_number_poem ) { - if (match(line, rgx.block_curly_code_open)) { + if (matchFirst(line, rgx.block_curly_code_open)) { /+ curly code open +/ debug(code) { // code (curly) open writefln( @@ -779,7 +779,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["code"] = TriState.on; type["curly_code"] = TriState.on; - } else if (match(line, rgx.block_curly_poem_open)) { + } else if (matchFirst(line, rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open writefln( @@ -795,7 +795,7 @@ template SiSUdocAbstraction() { type["verse_new"] = State.on; type["poem"] = TriState.on; type["curly_poem"] = TriState.on; - } else if (match(line, rgx.block_curly_group_open)) { + } else if (matchFirst(line, rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open writefln( @@ -808,7 +808,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["group"] = TriState.on; type["curly_group"] = TriState.on; - } else if (match(line, rgx.block_curly_block_open)) { + } else if (matchFirst(line, rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open writefln( @@ -821,7 +821,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["block"] = TriState.on; type["curly_block"] = TriState.on; - } else if (match(line, rgx.block_curly_quote_open)) { + } else if (matchFirst(line, rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open writefln( @@ -834,7 +834,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["quote"] = TriState.on; type["curly_quote"] = TriState.on; - } else if (match(line, rgx.block_curly_table_open)) { + } else if (matchFirst(line, rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( @@ -847,7 +847,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["table"] = TriState.on; type["curly_table"] = TriState.on; - } else if (match(line, rgx.block_tic_code_open)) { + } else if (matchFirst(line, rgx.block_tic_code_open)) { /+ tic code open +/ debug(code) { // code (tic) open writefln( @@ -860,7 +860,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["code"] = TriState.on; type["tic_code"] = TriState.on; - } else if (match(line, rgx.block_tic_poem_open)) { + } else if (matchFirst(line, rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open writefln( @@ -875,7 +875,7 @@ template SiSUdocAbstraction() { type["verse_new"] = State.on; type["poem"] = TriState.on; type["tic_poem"] = TriState.on; - } else if (match(line, rgx.block_tic_group_open)) { + } else if (matchFirst(line, rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open writefln( @@ -888,7 +888,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["group"] = TriState.on; type["tic_group"] = TriState.on; - } else if (match(line, rgx.block_tic_block_open)) { + } else if (matchFirst(line, rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open writefln( @@ -901,7 +901,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["block"] = TriState.on; type["tic_block"] = TriState.on; - } else if (match(line, rgx.block_tic_quote_open)) { + } else if (matchFirst(line, rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open writefln( @@ -914,7 +914,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["quote"] = TriState.on; type["tic_quote"] = TriState.on; - } else if (match(line, rgx.block_tic_table_open)) { + } else if (matchFirst(line, rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( @@ -936,7 +936,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_code"] == TriState.on) { - if (auto m = match(line, rgx.block_curly_code_close)) { + if (matchFirst(line, rgx.block_curly_code_close)) { debug(code) { // code (curly) close tell_l("blue", line); } @@ -947,10 +947,10 @@ template SiSUdocAbstraction() { debug(code) { // code (curly) line tell_l("blue", line); } - an_object["obj"] ~= line ~= "\n"; // code (curly) line + an_object["obj"] ~= line ~= "\n"; // code (curly) line } } else if (type["tic_code"] == TriState.on) { - if (auto m = match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(code) { // code (tic) close tell_l("blue", line); } @@ -961,7 +961,7 @@ template SiSUdocAbstraction() { debug(code) { // code (tic) line tell_l("blue", line); } - an_object["obj"] ~= line ~= "\n"; // code (tic) line + an_object["obj"] ~= line ~= "\n"; // code (tic) line } } return 0; @@ -991,7 +991,7 @@ template SiSUdocAbstraction() { ref int bib_entry, ref string[] biblio_arr_json ) { - if (match(line, rgx.heading_biblio)) { + if (matchFirst(line, rgx.heading_biblio)) { type["heading_biblio"] = TriState.on; } if (empty(line) && (bib_entry == TriState.off)) { @@ -1006,7 +1006,7 @@ template SiSUdocAbstraction() { line ); } - if (match(line, rgx.biblio_tags)) { + if (matchFirst(line, rgx.biblio_tags)) { auto bt = match(line, rgx.biblio_tags); bib_entry = 0; st=to!string(bt.captures[1]); @@ -1081,7 +1081,7 @@ template SiSUdocAbstraction() { string[string] obj_cite_number_poem ) { if (type["curly_poem"] == TriState.on) { - if (auto m = match(line, rgx.block_curly_poem_close)) { + if (matchFirst(line, rgx.block_curly_poem_close)) { an_object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close writefln( @@ -1140,7 +1140,7 @@ template SiSUdocAbstraction() { obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); type["verse_new"] = State.off; - } else if (match(line, rgx.line_delimiter_only)) { + } else if (matchFirst(line, rgx.line_delimiter_only)) { verse_line = TriState.off; type["verse_new"] = State.on; } @@ -1181,7 +1181,7 @@ template SiSUdocAbstraction() { } } } else if (type["tic_poem"] == TriState.on) { - if (auto m = match(line, rgx.block_tic_close)) { // tic_poem_close + if (auto m = matchFirst(line, rgx.block_tic_close)) { // tic_poem_close an_object["obj"]="verse"; // check that this is as you please debug(poem) { // poem (curly) close writefln( @@ -1226,7 +1226,7 @@ template SiSUdocAbstraction() { obj_cite_number = obj_cite_number_emit(type["obj_cite_number_status"]); type["verse_new"] = State.off; - } else if (match(line, rgx.line_delimiter_only)) { + } else if (matchFirst(line, rgx.line_delimiter_only)) { type["verse_new"] = State.on; verse_line = TriState.off; } @@ -1276,7 +1276,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_group"] == State.on) { - if (match(line, rgx.block_curly_group_close)) { + if (matchFirst(line, rgx.block_curly_group_close)) { debug(group) { // group (curly) close tell_l("blue", line); } @@ -1290,7 +1290,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build group array (or string) } } else if (type["tic_group"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(group) { // group (tic) close tell_l("blue", line); } @@ -1312,7 +1312,7 @@ template SiSUdocAbstraction() { ref int[string] type ) { if (type["curly_block"] == TriState.on) { - if (match(line, rgx.block_curly_block_close)) { + if (matchFirst(line, rgx.block_curly_block_close)) { debug(block) { // block (curly) close tell_l("blue", line); } @@ -1326,7 +1326,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build block array (or string) } } else if (type["tic_block"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(block) { // block (tic) close tell_l("blue", line); } @@ -1344,7 +1344,7 @@ template SiSUdocAbstraction() { } auto quote_block(char[] line, ref string[string] an_object, ref int[string] type) { if (type["curly_quote"] == TriState.on) { - if (match(line, rgx.block_curly_quote_close)) { + if (matchFirst(line, rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close tell_l("blue", line); } @@ -1358,7 +1358,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build quote array (or string) } } else if (type["tic_quote"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(quote) { // quote (tic) close tell_l("blue", line); } @@ -1376,7 +1376,7 @@ template SiSUdocAbstraction() { } auto table_block(char[] line, ref string[string] an_object, ref int[string] type) { if (type["curly_table"] == TriState.on) { - if (match(line, rgx.block_curly_table_close)) { + if (matchFirst(line, rgx.block_curly_table_close)) { debug(table) { // table (curly) close tell_l("blue", line); } @@ -1390,7 +1390,7 @@ template SiSUdocAbstraction() { an_object["obj"] ~= line ~= "\n"; // build table array (or string) } } else if (type["tic_table"] == TriState.on) { - if (match(line, rgx.block_tic_close)) { + if (matchFirst(line, rgx.block_tic_close)) { debug(table) { // table (tic) close tell_l("blue", line); } @@ -1674,7 +1674,7 @@ template SiSUdocAbstraction() { ref string[string] an_object, ref int[string] type ) { - if (auto m = match(line, rgx.header_make)) { + if (matchFirst(line, rgx.header_make)) { /+ matched header_make +/ debug(header1) { // header tell_l("yellow", line); @@ -1686,7 +1686,7 @@ template SiSUdocAbstraction() { type["para"] = State.off; ++line_occur["header_make"]; an_object["obj"] ~= line ~= "\n"; - } else if (auto m = match(line, rgx.header_metadata)) { + } else if (matchFirst(line, rgx.header_metadata)) { /+ matched header_metadata +/ debug(header1) { // header tell_l("yellow", line); @@ -1701,7 +1701,7 @@ template SiSUdocAbstraction() { } else if (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) { /+ header_make flag set +/ - if (auto m = match(line, rgx.header_sub)) { + if (matchFirst(line, rgx.header_sub)) { /+ sub-header +/ debug(header1) { tell_l("yellow", line); @@ -1713,7 +1713,7 @@ template SiSUdocAbstraction() { } else if (type["header_metadata"] == State.on && (line_occur["header_metadata"] > State.off)) { /+ header_metadata flag set +/ - if (auto m = match(line, rgx.header_sub)) { + if (matchFirst(line, rgx.header_sub)) { /+ sub-header +/ debug(header1) { tell_l("yellow", line); @@ -1824,43 +1824,43 @@ template SiSUdocAbstraction() { && ((type["para"] == State.off) && (type["heading"] == State.off))) { /+ heading make set +/ - if (match(line, heading_match_rgx["h_B"])) { + if (matchFirst(line, heading_match_rgx["h_B"])) { line = "B~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_C"])) { + if (matchFirst(line, heading_match_rgx["h_C"])) { line = "C~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_D"])) { + if (matchFirst(line, heading_match_rgx["h_D"])) { line = "D~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_1"])) { + if (matchFirst(line, heading_match_rgx["h_1"])) { line = "1~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_2"])) { + if (matchFirst(line, heading_match_rgx["h_2"])) { line = "2~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_3"])) { + if (matchFirst(line, heading_match_rgx["h_3"])) { line = "3~ " ~ line; debug(headingsfound) { writeln(line); } } - if (match(line, heading_match_rgx["h_4"])) { + if (matchFirst(line, heading_match_rgx["h_4"])) { line = "4~ " ~ line; debug(headingsfound) { writeln(line); @@ -1874,7 +1874,8 @@ template SiSUdocAbstraction() { ref string[string] an_object, ref int[string] lv, ref int[string] collapsed_lev, - ref int[string] type + ref int[string] type, + ref JSONValue[string] dochead_meta ) { if (auto m = match(line, rgx.heading)) { /+ heading match +/ @@ -1890,6 +1891,8 @@ template SiSUdocAbstraction() { assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels switch (an_object["lev"]) { case "A": + an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(dochead_meta["title"]["main"])); + an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(dochead_meta["creator"]["author"])); collapsed_lev["h0"] = 1; an_object["lev_collapsed_number"] = to!string(collapsed_lev["h0"]); @@ -2017,7 +2020,7 @@ template SiSUdocAbstraction() { /+ para matches +/ // paragraphs // (fl ag_type["heading"] = true) && - if (auto m = match(line, rgx.para_indent)) { + if (auto m = matchFirst(line, rgx.para_indent)) { debug(paraindent) { // para indent tell_l("blue", line); } @@ -2026,7 +2029,7 @@ template SiSUdocAbstraction() { indent["first"] = to!string(m.captures[1]); indent["second"] = "0"; bullet = false; - } else if (auto m = match(line, rgx.para_bullet)) { + } else if (matchFirst(line, rgx.para_bullet)) { debug(parabullet) { // para bullet tell_l("blue", line); } @@ -2035,7 +2038,7 @@ template SiSUdocAbstraction() { indent["first"] = "0"; indent["second"] = "0"; bullet = true; - } else if (auto m = match(line, rgx.para_indent_hang)) { + } else if (auto m = matchFirst(line, rgx.para_indent_hang)) { debug(paraindenthang) { // para indent hang tell_l("blue", line); } @@ -2044,7 +2047,7 @@ template SiSUdocAbstraction() { indent["first"] = to!string(m.captures[1]); indent["second"] = to!string(m.captures[2]); bullet = false; - } else if (auto m = match(line, rgx.para_bullet_indent)) { + } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) { debug(parabulletindent) { // para bullet indent tell_l("blue", line); } @@ -2092,19 +2095,19 @@ template SiSUdocAbstraction() { body { auto rgx = Rgx(); obj_txt["munge"]=obj_txt_in; - if (match(obj_txt_in, rgx.para_bullet)) { + if (matchFirst(obj_txt_in, rgx.para_bullet)) { obj_txt["attrib"] =" \"bullet\": \"true\"," ~ " \"indent_first\": 0," ~ " \"indent_rest\": 0,"; - } else if (auto m = match(obj_txt_in, rgx.para_bullet_indent)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) { obj_txt["attrib"] =" \"bullet\": \"true\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; - } else if (auto m = match(obj_txt_in, rgx.para_indent_hang)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) { obj_txt["attrib"] =" \"bullet\": \"false\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ","; - } else if (auto m = match(obj_txt_in, rgx.para_indent)) { + } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) { obj_txt["attrib"] =" \"bullet\": \"false\"," ~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ "," ~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ","; @@ -2578,14 +2581,14 @@ template SiSUdocAbstraction() { string hm, hs; auto header_metadata_and_make_jsonstr( string header, - JSONValue[string] dochead_metadata, + JSONValue[string] dochead_meta, JSONValue[string] dochead_make ) in { } body { scope(exit) { destroy(header); - destroy(dochead_metadata); + destroy(dochead_meta); destroy(dochead_make); } if (auto t = match(header, rgx.head_main)) { @@ -2599,13 +2602,13 @@ template SiSUdocAbstraction() { if (auto m = match(line, rgx.head_main)) { if (!empty(m.captures[2])) { if (hm == "creator") { - dochead_metadata[hm]["author"].str = + dochead_meta[hm]["author"].str = to!string(m.captures[2]); } else if (hm == "title") { - dochead_metadata[hm]["main"].str = + dochead_meta[hm]["main"].str = to!string(m.captures[2]); } else if (hm == "publisher") { - dochead_metadata[hm]["name"].str = + dochead_meta[hm]["name"].str = to!string(m.captures[2]); } } @@ -2629,12 +2632,12 @@ template SiSUdocAbstraction() { default: break; } - } else if (dochead_metadata[hm].type() == JSON_TYPE.OBJECT) { + } else if (dochead_meta[hm].type() == JSON_TYPE.OBJECT) { switch (hm) { case "creator": if (match(hs, rgx.subhead_creator)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2646,11 +2649,11 @@ template SiSUdocAbstraction() { case "title": if (match(hs, rgx.subhead_title)) { if ((hs == "subtitle") - && (dochead_metadata[hm]["sub"].type() == JSON_TYPE.STRING)) { - dochead_metadata[hm]["sub"].str = + && (dochead_meta[hm]["sub"].type() == JSON_TYPE.STRING)) { + dochead_meta[hm]["sub"].str = to!string(s.captures[2]); - } else if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + } else if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2661,8 +2664,8 @@ template SiSUdocAbstraction() { break; case "rights": if (match(hs, rgx.subhead_rights)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2673,8 +2676,8 @@ template SiSUdocAbstraction() { break; case "date": if (match(hs, rgx.subhead_date)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2685,8 +2688,8 @@ template SiSUdocAbstraction() { break; case "original": if (match(hs, rgx.subhead_original)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2697,8 +2700,8 @@ template SiSUdocAbstraction() { break; case "classify": if (match(hs, rgx.subhead_classify)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2709,8 +2712,8 @@ template SiSUdocAbstraction() { break; case "identifier": if (match(hs, rgx.subhead_identifier)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2721,8 +2724,8 @@ template SiSUdocAbstraction() { break; case "notes": if (match(hs, rgx.subhead_notes)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2733,8 +2736,8 @@ template SiSUdocAbstraction() { break; case "publisher": if (match(hs, rgx.subhead_publisher)) { - if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - dochead_metadata[hm][hs].str = + if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + dochead_meta[hm][hs].str = to!string(s.captures[2]); } } else { @@ -2747,8 +2750,8 @@ template SiSUdocAbstraction() { destroy(hm); destroy(hs); // if (match(hs, rgx.subhead_links)) { - // if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) { - // dochead_metadata[hm][hs].str = to!string(s.captures[2]); + // if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) { + // dochead_meta[hm][hs].str = to!string(s.captures[2]); // } // } else { // writeln("not a valid header type:", hm, ":", hs); @@ -2767,7 +2770,7 @@ template SiSUdocAbstraction() { writeln("not a valid header type:", hm); } } - auto t = tuple(dochead_metadata, dochead_make); + auto t = tuple(dochead_meta, dochead_make); static assert(!isTypeTuple!(t)); return t; } -- cgit v1.2.3