From 5a4df097b2976c24c449c56cf035995edfb1261e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 7 Mar 2017 09:11:09 -0500 Subject: 0.13.6 dlang function calls, syntax (ufcs related), logic should be retained --- org/ao_conf_make_meta.org | 54 ++-- org/ao_debugs.org | 20 +- org/ao_doc_abstraction.org | 576 +++++++++++++++++++++---------------------- org/ao_read_source_files.org | 49 ++-- org/output.org | 51 ++-- org/sdp.org | 10 +- 6 files changed, 374 insertions(+), 386 deletions(-) (limited to 'org') diff --git a/org/ao_conf_make_meta.org b/org/ao_conf_make_meta.org index 398b369..30e16a0 100644 --- a/org/ao_conf_make_meta.org +++ b/org/ao_conf_make_meta.org @@ -54,7 +54,7 @@ template SiSUheaderExtractHub() { } auto head_native = HeaderDocMetadataAndMakeNativeToAA(); auto head_sdlang = HeaderExtractSDL(); - auto header_make_and_meta_tuple = (match(header_src, rgx.native_header_meta_title)) + auto header_make_and_meta_tuple = (header_src.match(rgx.native_header_meta_title)) ? (head_native.headerNativeToAA(header_src)) : (head_sdlang.headerSDLangToAA(header_src, conf_doc_make_aa)); static assert(!isTypeTuple!(header_make_and_meta_tuple)); @@ -320,7 +320,7 @@ private auto headerSDLangGet(Hs)(Hs src_header) { static assert(is(typeof(src_header) == char[])); } char[][] source_header_arr = - split(cast(char[]) src_header, rgx.newline_eol_delimiter); + (cast(char[]) src_header).split(rgx.newline_eol_delimiter); char[] header_clean; // TODO foreach(header_line; source_header_arr) { @@ -373,9 +373,9 @@ private auto headerSDLangToAAmake(Tag,Ma)(Tag header_sdlang, Ma dochead_make) { } dochead_meta["creator"]["author_raw"] = dochead_meta["creator"]["author"]; string[] authors_arr; - auto authors_raw_arr = split(dochead_meta["creator"]["author"], rgx.arr_delimiter); + auto authors_raw_arr = dochead_meta["creator"]["author"].split(rgx.arr_delimiter); foreach (author_raw; authors_raw_arr) { - authors_arr ~= (author_raw).replace(rgx.raw_author_munge, "$2 $1"); + authors_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1"); } dochead_meta["creator"]["author"] = join(authors_arr, ", ").chomp.chomp; auto t = tuple(dochead_make, dochead_meta); @@ -454,15 +454,13 @@ body { destroy(dochead_meta); destroy(dochead_make); } - if (auto t = match(header, rgx.native_header_main)) { - char[][] header_obj_spl = split( - cast(char[]) header, - rgx.line_delimiter_ws_strip - ); + if (auto t = header.match(rgx.native_header_main)) { + char[][] header_obj_spl = + (cast(char[]) header).split(rgx.line_delimiter_ws_strip); auto hm = to!string(t.captures[1]); - if (match(hm, rgx.main_headers)) { + if (hm.match(rgx.main_headers)) { foreach (line; header_obj_spl) { - if (auto m = match(line, rgx.native_header_main)) { + if (auto m = line.match(rgx.native_header_main)) { if (!empty(m.captures[2])) { if (hm == "creator") { dochead_meta[hm]["author"] = @@ -482,7 +480,7 @@ body { && (dochead_make[hm])) { switch (hm) { case "make": - if (match(hs, rgx.native_subhead_make)) { + if (hs.match(rgx.native_subhead_make)) { if (dochead_make[hm][hs]) { dochead_make[hm][hs] = to!string(s.captures[2]); } @@ -498,7 +496,7 @@ body { } else if (dochead_meta[hm]) { switch (hm) { case "creator": - if (match(hs, rgx.native_subhead_creator)) { + if (hs.match(rgx.native_subhead_creator)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -510,7 +508,7 @@ body { } break; case "title": - if (match(hs, rgx.native_subhead_title)) { + if (hs.match(rgx.native_subhead_title)) { if ((hs == "subtitle") && (dochead_meta[hm]["sub"])) { dochead_meta[hm]["sub"] = @@ -526,7 +524,7 @@ body { } break; case "rights": - if (match(hs, rgx.native_subhead_rights)) { + if (hs.match(rgx.native_subhead_rights)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -538,7 +536,7 @@ body { } break; case "date": - if (match(hs, rgx.native_subhead_date)) { + if (hs.match(rgx.native_subhead_date)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -550,7 +548,7 @@ body { } break; case "original": - if (match(hs, rgx.native_subhead_original)) { + if (hs.match(rgx.native_subhead_original)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -562,7 +560,7 @@ body { } break; case "classify": - if (match(hs, rgx.native_subhead_classify)) { + if (hs.match(rgx.native_subhead_classify)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -574,7 +572,7 @@ body { } break; case "identifier": - if (match(hs, rgx.native_subhead_identifier)) { + if (hs.match(rgx.native_subhead_identifier)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -586,7 +584,7 @@ body { } break; case "notes": - if (match(hs, rgx.native_subhead_notes)) { + if (hs.match(rgx.native_subhead_notes)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -598,7 +596,7 @@ body { } break; case "publisher": - if (match(hs, rgx.native_subhead_publisher)) { + if (hs.match(rgx.native_subhead_publisher)) { if (dochead_meta[hm][hs]) { dochead_meta[hm][hs] = to!string(s.captures[2]); @@ -646,14 +644,14 @@ private auto native_header_extract(L,Lo,O,T)( static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); } - if (matchFirst(line, rgx.native_header_make)) { /+ matched header_make +/ + if (line.matchFirst(rgx.native_header_make)) { /+ matched header_make +/ debug(header1) { /+ writeln(line); +/ } type["header"] = State.on; type["header_make"] = State.on; type["header_meta"] = State.off; ++line_occur["header_make"]; an_object["body_nugget"] ~= line ~= "\n"; - } else if (matchFirst(line, rgx.native_header)) { /+ matched header_metadata +/ + } else if (line.matchFirst(rgx.native_header)) { /+ matched header_metadata +/ /+ (generic header match and not previously caught by header_make) +/ debug(header1) { /+ writeln(line); +/ } type["header"] = State.on; @@ -663,14 +661,14 @@ private auto native_header_extract(L,Lo,O,T)( an_object["body_nugget"] ~= line ~= "\n"; } else if (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) { /+ header_make flag set +/ - if (matchFirst(line, rgx.native_header_sub)) { /+ sub-header +/ + if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ debug(header1) { /+ writeln(line); +/ } ++line_occur["header_make"]; an_object["body_nugget"] ~= line ~= "\n"; } } else if (type["header_meta"] == State.on && (line_occur["header_meta"] > State.off)) { /+ header_metadata flag set +/ - if (matchFirst(line, rgx.native_header_sub)) { /+ sub-header +/ + if (line.matchFirst(rgx.native_header_sub)) { /+ sub-header +/ debug(header1) { /+ writeln(line); +/ } ++line_occur["header_meta"]; an_object["body_nugget"] ~= line ~= "\n"; @@ -723,14 +721,14 @@ private auto headerNativeToAA(Hn)(Hn src_header) { auto dochead_meta = meta_aa; auto set_header = HeaderDocMetadataAndMakeNativeToAA(); char[][] source_header_arr = - split(cast(char[]) src_header, rgx.newline_eol_delimiter); + (cast(char[]) src_header).split(rgx.newline_eol_delimiter); foreach(header_line; source_header_arr) { - if (auto m = matchFirst(header_line, rgx.comment)) { + if (auto m = header_line.matchFirst(rgx.comment)) { /+ matched comment +/ debug(comment) { } header_reset_states_common(line_occur, an_object, type); - } else if ((matchFirst(header_line, rgx.native_header)) + } else if ((header_line.matchFirst(rgx.native_header)) || (type["header_make"] == State.on && (line_occur["header_make"] > State.off)) || (type["header_meta"] == State.on diff --git a/org/ao_debugs.org b/org/ao_debugs.org index 16efa26..c35ff2e 100644 --- a/org/ao_debugs.org +++ b/org/ao_debugs.org @@ -499,7 +499,7 @@ debug(headermakejson) { switch (main_header) { case "make": foreach (sub_header; ptr_head_sub_make) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -531,7 +531,7 @@ debug(headermetadatajson) { switch (main_header) { case "creator": foreach (sub_header; ptr_head_sub_creator) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -543,7 +543,7 @@ debug(headermetadatajson) { break; case "title": foreach (sub_header; ptr_head_sub_title) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -555,7 +555,7 @@ debug(headermetadatajson) { break; case "rights": foreach (sub_header; ptr_head_sub_rights) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -567,7 +567,7 @@ debug(headermetadatajson) { break; case "date": foreach (sub_header; ptr_head_sub_date) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -579,7 +579,7 @@ debug(headermetadatajson) { break; case "original": foreach (sub_header; ptr_head_sub_original) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -591,7 +591,7 @@ debug(headermetadatajson) { break; case "classify": foreach (sub_header; ptr_head_sub_classify) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -603,7 +603,7 @@ debug(headermetadatajson) { break; case "identifier": foreach (sub_header; ptr_head_sub_identifier) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -615,7 +615,7 @@ debug(headermetadatajson) { break; case "notes": foreach (sub_header; ptr_head_sub_notes) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, @@ -627,7 +627,7 @@ debug(headermetadatajson) { break; case "publisher": foreach (sub_header; ptr_head_sub_publisher) { - if (to!string(doc_matters.dochead_meta[main_header][sub_header]).length > 2) { + if (doc_matters.dochead_meta[main_header][sub_header].to!string.length > 2) { writefln( "%s:%s: %s", main_header, diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index 2188e94..aac99f7 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -136,7 +136,7 @@ template SiSUdocAbstraction() { } else { /+ not within a block group +/ <> - if (matchFirst(line, rgx.block_open)) { + if (line.matchFirst(rgx.block_open)) { <> } else if (!line.empty) { /+ line not empty +/ @@ -319,47 +319,47 @@ void heading_ancestors(O)( ) { switch (obj.heading_lev_markup) { case 0: - lv_ancestors[0] = to!string(obj.text); + lv_ancestors[0] = obj.text.to!string; foreach(k; 1..8) { lv_ancestors[k] = ""; } goto default; case 1: - lv_ancestors[1] = to!string(obj.text); + lv_ancestors[1] = obj.text.to!string; foreach(k; 2..8) { lv_ancestors[k] = ""; } goto default; case 2: - lv_ancestors[2] = to!string(obj.text); + lv_ancestors[2] = obj.text.to!string; foreach(k; 3..8) { lv_ancestors[k] = ""; } goto default; case 3: - lv_ancestors[3] = to!string(obj.text); + lv_ancestors[3] = obj.text.to!string; foreach(k; 4..8) { lv_ancestors[k] = ""; } goto default; case 4: - lv_ancestors[4] = to!string(obj.text); + lv_ancestors[4] = obj.text.to!string; foreach(k; 5..8) { lv_ancestors[k] = ""; } goto default; case 5: - lv_ancestors[5] = to!string(obj.text); + lv_ancestors[5] = obj.text.to!string; foreach(k; 6..8) { lv_ancestors[k] = ""; } goto default; case 6: - lv_ancestors[6] = to!string(obj.text); + lv_ancestors[6] = obj.text.to!string; lv_ancestors[7] = ""; goto default; case 7: - lv_ancestors[7] = to!string(obj.text); + lv_ancestors[7] = obj.text.to!string; goto default; default: obj.heading_ancestors_text = lv_ancestors.dup; @@ -647,11 +647,11 @@ continue; #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -if ((matchFirst(line, rgx.heading_biblio) +if (line.matchFirst(rgx.heading_biblio) || (type["biblio_section"] == State.on -&& (!matchFirst(line, rgx.heading_blurb_glossary)))) -&& (!matchFirst(line, rgx.heading)) -&& (!matchFirst(line, rgx.comment))) { +&& (!(line.matchFirst(rgx.heading_blurb_glossary))) +&& (!(line.matchFirst(rgx.heading))) +&& (!(line.matchFirst(rgx.comment))))) { /+ within section (block object): biblio +/ type["glossary_section"] = State.off; type["biblio_section"] = State.on; @@ -677,11 +677,11 @@ if there is a glossary section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if ((matchFirst(line, rgx.heading_glossary) +} else if (line.matchFirst(rgx.heading_glossary) || (type["glossary_section"] == State.on -&& (!matchFirst(line, rgx.heading_biblio_blurb)))) -&& (!matchFirst(line, rgx.heading)) -&& (!matchFirst(line, rgx.comment))) { +&& (!(line.matchFirst(rgx.heading_biblio_blurb))) +&& (!(line.matchFirst(rgx.heading))) +&& (!(line.matchFirst(rgx.comment))))) { /+ within section (block object): glossary +/ debug(glossary) { writeln(__LINE__); @@ -700,7 +700,7 @@ if there is a glossary section you need to: type["para"] = State.on; line_occur["para"] = State.off; an_object_key="glossary_nugget"; // - if (matchFirst(line, rgx.heading_glossary)) { + if (line.matchFirst(rgx.heading_glossary)) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.use = "backmatter"; comp_obj_heading_.is_of = "para"; @@ -735,7 +735,7 @@ if there is a glossary section you need to: comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; comp_obj_para.is_a = "glossary"; - comp_obj_para.text = to!string(line).strip; + comp_obj_para.text = line.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; comp_obj_para.indent_hang = indent["hang_position"]; @@ -759,11 +759,11 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if ((matchFirst(line, rgx.heading_blurb) +} else if (line.matchFirst(rgx.heading_blurb) || (type["blurb_section"] == State.on -&& (!matchFirst(line, rgx.heading_biblio_glossary)))) -&& (!matchFirst(line, rgx.heading)) -&& (!matchFirst(line, rgx.comment))) { +&& (!(line.matchFirst(rgx.heading_biblio_glossary))) +&& (!(line.matchFirst(rgx.heading))) +&& (!(line.matchFirst(rgx.comment))))) { /+ within section (block object): blurb +/ debug(blurb) { writeln(__LINE__); @@ -781,7 +781,7 @@ if there is a blurb section you need to: type["para"] = State.on; line_occur["para"] = State.off; an_object_key="blurb_nugget"; - if (matchFirst(line, rgx.heading_blurb)) { + if (line.matchFirst(rgx.heading_blurb)) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.use = "backmatter"; comp_obj_heading_.is_of = "para"; @@ -810,19 +810,19 @@ if there is a blurb section you need to: comp_obj_heading_.parent_lev_markup = 0; comp_obj_heading_.anchor_tags = ["blurb"]; the_blurb_section ~= comp_obj_heading_; - } else if ((matchFirst(line, rgx.heading)) + } else if (line.matchFirst(rgx.heading) && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.use = "backmatter"; comp_obj_heading_.is_of = "para"; comp_obj_heading_.is_a = "heading"; - comp_obj_heading_.text = to!string(line); + comp_obj_heading_.text = line.to!string; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; comp_obj_heading_.segment_anchor_tag = "blurb"; - comp_obj_heading_.marked_up_level = to!string(an_object["lev"]); - comp_obj_heading_.heading_lev_markup = to!int(an_object["lev_markup_number"]); // make int, remove need to conv - comp_obj_heading_.heading_lev_collapsed = to!int(an_object["lev_collapsed_number"]); // make int, remove need to conv + comp_obj_heading_.marked_up_level = an_object["lev"].to!string; + comp_obj_heading_.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv + comp_obj_heading_.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv comp_obj_heading_.parent_ocn = 1; comp_obj_heading_.parent_lev_markup = 0; the_blurb_section ~= comp_obj_heading_; @@ -832,7 +832,7 @@ if there is a blurb section you need to: comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; comp_obj_para.is_a = "blurb"; - comp_obj_para.text = to!string(line).strip; + comp_obj_para.text = line.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; comp_obj_para.indent_hang = indent["hang_position"]; @@ -914,11 +914,11 @@ assertions_flag_types_block_status_none_or_closed(type); #+name: abs_in_loop_body_open_block_obj #+BEGIN_SRC d -if (matchFirst(line, (rgx.block_poem_open))) { +if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); - obj_cite_number_poem["start"] = to!string(obj_cite_number); + obj_cite_number_poem["start"] = obj_cite_number.to!string; } _start_block_(line, type, obj_cite_number_poem); continue; @@ -945,8 +945,8 @@ if (type["blocks"] == TriState.closing) { writeln(line); } assert( - matchFirst(line, rgx.book_index) - || matchFirst(line, rgx.book_index_open) + line.matchFirst(rgx.book_index) + || line.matchFirst(rgx.book_index_open) || type["book_index"] == State.on ); } @@ -956,9 +956,9 @@ if (type["blocks"] == TriState.closing) { #+name: abs_in_loop_body_not_block_obj #+BEGIN_SRC d -if ((matchFirst(line, rgx.book_index)) -|| (matchFirst(line, rgx.book_index_open)) -|| (type["book_index"] == State.on )) { +if (line.matchFirst(rgx.book_index) +|| line.matchFirst(rgx.book_index_open) +|| type["book_index"] == State.on ) { /+ book_index +/ _book_index_(line, book_idx_tmp, an_object, type, opt_action_bool); #+END_SRC @@ -1022,7 +1022,7 @@ if ((matchFirst(line, rgx.book_index)) - should happen before endnote links set (they need to be moved down?) // node_construct.node_emitter_heading segment anchor tag +/ - if (matchFirst(line, rgx.heading)) { + if (line.matchFirst(rgx.heading)) { /+ heading match +/ _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); } else if (line_occur["para"] == State.off) { @@ -1101,7 +1101,7 @@ assert( if ((type["heading"] == State.on) && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ - obj_cite_number = (to!int(an_object["lev_markup_number"]) == 0) + obj_cite_number = (an_object["lev_markup_number"].to!int == 0) ? (ocn_emit(3)) : (obj_cite_number = ocn_emit(type["ocn_status"])); an_object["is"] = "heading"; @@ -1110,14 +1110,14 @@ if ((type["heading"] == State.on) obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; - if (to!int(an_object["lev_markup_number"]) == 4) { + if (an_object["lev_markup_number"].to!int == 4) { segment_anchor_tag_that_object_belongs_to = anchor_tags[0]; segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix"; anchor_tag_ = anchor_tags[0]; - } else if (to!int(an_object["lev_markup_number"]) > 4) { + } else if (an_object["lev_markup_number"].to!int > 4) { segment_anchor_tag_that_object_belongs_to = anchor_tag_; - segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ to!string(obj_cite_number); - } else if (to!int(an_object["lev_markup_number"]) < 4) { + segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_number.to!string; + } else if (an_object["lev_markup_number"].to!int < 4) { segment_anchor_tag_that_object_belongs_to = ""; segment_anchor_tag_that_object_belongs_to_uri = ""; } @@ -1204,9 +1204,9 @@ if ((type["heading"] == State.on) comp_obj_para.use = "body"; comp_obj_para.is_of = "para"; comp_obj_para.is_a = "para"; - comp_obj_para.text = to!string(an_object["substantive"]).strip; + comp_obj_para.text = an_object["substantive"].to!string.strip; comp_obj_para.ocn = obj_cite_number; - comp_obj_para.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_para.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_para.indent_hang = indent["hang_position"]; comp_obj_para.indent_base = indent["base_position"]; comp_obj_para.bullet = bullet; @@ -1248,12 +1248,11 @@ if (the_document_body_section.length > 0) { type["glossary_section"] = State.off; type["blurb_section"] = State.off; } - previous_length = to!int(the_document_body_section.length); - if (match( - the_document_body_section[$-1].text, + previous_length = the_document_body_section.length.to!int; + if ((the_document_body_section[$-1].text).match( rgx.inline_notes_delimiter_al_regular_number_note )) { - previous_count=to!int(the_document_body_section.length -1); + previous_count=(the_document_body_section.length -1).to!int; note_section.gather_notes_for_endnote_section( the_document_body_section, segment_anchor_tag_that_object_belongs_to, @@ -1409,7 +1408,7 @@ foreach (entry; biblio_ordered) { comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; comp_obj_para.is_a = "bibliography"; - comp_obj_para.text = to!string(out_).strip; + comp_obj_para.text = out_.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; comp_obj_para.indent_hang = 0; @@ -1536,7 +1535,7 @@ if (the_endnotes_section.length > 1) { ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; } @@ -1549,7 +1548,7 @@ if (the_glossary_section.length > 1) { ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( @@ -1558,7 +1557,7 @@ if (the_glossary_section.length > 1) { "glossary", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["scroll"] ~= comp_obj_toc; } @@ -1571,7 +1570,7 @@ if (the_bibliography_section.length > 1){ ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; @@ -1581,7 +1580,7 @@ if (the_bibliography_section.length > 1){ "bibliography", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["scroll"] ~= comp_obj_toc; } @@ -1594,7 +1593,7 @@ if (the_bookindex_section["seg"].length > 1) { ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; } @@ -1605,7 +1604,7 @@ if (the_bookindex_section["scroll"].length > 1) { "bookindex", // _anchor_tag ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["scroll"] ~= comp_obj_toc; } @@ -1618,7 +1617,7 @@ if (the_blurb_section.length > 1) { ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; toc_txt_ = format( @@ -1628,7 +1627,7 @@ if (the_blurb_section.length > 1) { ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.inline_links = true; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; the_table_of_contents_section["scroll"] ~= comp_obj_toc; } debug(toc) { @@ -1763,7 +1762,7 @@ next are not yet known for backmatter during the second pass string[] _images; auto extract_images(S)(S content_block) { string[] images_; - if (auto m = matchAll(content_block, rgx.image)) { + if (auto m = content_block.matchAll(rgx.image)) { images_ ~= m.captures[1]; } return images_; @@ -2221,15 +2220,15 @@ void _check_ocn_status_(L,T)( auto rgx = Rgx(); if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ - if (matchFirst(line, rgx.obj_cite_number_block_marks)) { + if (line.matchFirst(rgx.obj_cite_number_block_marks)) { /+ switch off obj_cite_number +/ - if (matchFirst(line, rgx.obj_cite_number_off_block)) { + if (line.matchFirst(rgx.obj_cite_number_off_block)) { type["ocn_status_multi_obj"] = TriState.on; debug(ocnoff) { writeln(line); } } - if (matchFirst(line, rgx.obj_cite_number_off_block_dh)) { + if (line.matchFirst(rgx.obj_cite_number_off_block_dh)) { type["ocn_status_multi_obj"] = TriState.closing; debug(ocnoff) { writeln(line); @@ -2237,9 +2236,9 @@ void _check_ocn_status_(L,T)( } } else { if (type["ocn_status_multi_obj"] == TriState.off) { - if (matchFirst(line, rgx.obj_cite_number_off)) { + if (line.matchFirst(rgx.obj_cite_number_off)) { type["ocn_status"] = TriState.on; - } else if (matchFirst(line, rgx.obj_cite_number_off_dh)) { + } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { type["ocn_status"] = TriState.closing; } else { type["ocn_status"] = TriState.off; @@ -2250,7 +2249,7 @@ void _check_ocn_status_(L,T)( } } } else if ((!line.empty) && (type["ocn_status_multi_obj"] > TriState.off)) { - if (matchFirst(line, rgx.obj_cite_number_off_block_close)) { + if (line.matchFirst(rgx.obj_cite_number_off_block_close)) { type["ocn_status_multi_obj"] = TriState.off; type["ocn_status"] = TriState.off; debug(ocnoff) { @@ -2284,7 +2283,7 @@ void _start_block_(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d auto rgx = Rgx(); - if (matchFirst(line, rgx.block_curly_code_open)) { + if (line.matchFirst(rgx.block_curly_code_open)) { /+ curly code open +/ debug(code) { // code (curly) open writefln( @@ -2295,7 +2294,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["code"] = TriState.on; type["curly_code"] = TriState.on; - } else if (matchFirst(line, rgx.block_curly_poem_open)) { + } else if (line.matchFirst(rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open writefln( @@ -2304,12 +2303,12 @@ void _start_block_(L,T,N)( ); } obj_cite_number_poem["start"] = - to!string(obj_cite_number); + obj_cite_number.to!string; type["blocks"] = TriState.on; type["verse_new"] = State.on; type["poem"] = TriState.on; type["curly_poem"] = TriState.on; - } else if (matchFirst(line, rgx.block_curly_group_open)) { + } else if (line.matchFirst(rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open writefln( @@ -2320,7 +2319,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["group"] = TriState.on; type["curly_group"] = TriState.on; - } else if (matchFirst(line, rgx.block_curly_block_open)) { + } else if (line.matchFirst(rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open writefln( @@ -2331,7 +2330,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["block"] = TriState.on; type["curly_block"] = TriState.on; - } else if (matchFirst(line, rgx.block_curly_quote_open)) { + } else if (line.matchFirst(rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open writefln( @@ -2342,7 +2341,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["quote"] = TriState.on; type["curly_quote"] = TriState.on; - } else if (matchFirst(line, rgx.block_curly_table_open)) { + } else if (line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( @@ -2359,7 +2358,7 @@ void _start_block_(L,T,N)( #+name: abs_functions_block #+BEGIN_SRC d - } else if (matchFirst(line, rgx.block_tic_code_open)) { + } else if (line.matchFirst(rgx.block_tic_code_open)) { /+ tic code open +/ debug(code) { // code (tic) open writefln( @@ -2370,7 +2369,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["code"] = TriState.on; type["tic_code"] = TriState.on; - } else if (matchFirst(line, rgx.block_tic_poem_open)) { + } else if (line.matchFirst(rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open writefln( @@ -2378,12 +2377,12 @@ void _start_block_(L,T,N)( line ); } - obj_cite_number_poem["start"] = to!string(obj_cite_number); + obj_cite_number_poem["start"] = obj_cite_number.to!string; type["blocks"] = TriState.on; type["verse_new"] = State.on; type["poem"] = TriState.on; type["tic_poem"] = TriState.on; - } else if (matchFirst(line, rgx.block_tic_group_open)) { + } else if (line.matchFirst(rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open writefln( @@ -2394,7 +2393,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["group"] = TriState.on; type["tic_group"] = TriState.on; - } else if (matchFirst(line, rgx.block_tic_block_open)) { + } else if (line.matchFirst(rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open writefln( @@ -2405,7 +2404,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["block"] = TriState.on; type["tic_block"] = TriState.on; - } else if (matchFirst(line, rgx.block_tic_quote_open)) { + } else if (line.matchFirst(rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open writefln( @@ -2416,7 +2415,7 @@ void _start_block_(L,T,N)( type["blocks"] = TriState.on; type["quote"] = TriState.on; type["tic_quote"] = TriState.on; - } else if (matchFirst(line, rgx.block_tic_table_open)) { + } else if (line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( @@ -2454,7 +2453,7 @@ void _code_block_(L,O,T)( } auto rgx = Rgx(); if (type["curly_code"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_code_close)) { + if (line.matchFirst(rgx.block_curly_code_close)) { debug(code) { // code (curly) close writeln(line); } @@ -2468,7 +2467,7 @@ void _code_block_(L,O,T)( an_object[an_object_key] ~= line ~= "\n"; // code (curly) line } } else if (type["tic_code"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { debug(code) { // code (tic) close writeln(line); } @@ -2588,7 +2587,7 @@ void _biblio_block_( mixin SiSUbiblio; auto jsn = BibJsnStr(); auto rgx = Rgx(); - if (matchFirst(line, rgx.heading_biblio)) { + if (line.matchFirst(rgx.heading_biblio)) { type["biblio_section"] = TriState.on; type["blurb_section"] = State.off; type["glossary_section"] = State.off; @@ -2623,16 +2622,16 @@ void _biblio_block_( writeln("?? 2. ERROR ", biblio_entry_str_json, "??"); biblio_entry_str_json = ""; } - } else if (matchFirst(line, rgx.biblio_tags)) { + } else if (line.matchFirst(rgx.biblio_tags)) { debug(biblioblock) { writeln(line); } - auto bt = match(line, rgx.biblio_tags); + auto bt = line.match(rgx.biblio_tags); bib_entry = State.off; - st=to!string(bt.captures[1]); - auto header_tag_value=to!string(bt.captures[2]); + st = bt.captures[1].to!string; + auto header_tag_value=(bt.captures[2]).to!string; JSONValue j = parseJSON(biblio_entry_str_json); - biblio_tag_name = (match(st, rgx.biblio_abbreviations)) + biblio_tag_name = (st.match(rgx.biblio_abbreviations)) ? (biblio_tag_map(st)) : st; j.object[biblio_tag_name] = header_tag_value; @@ -2643,11 +2642,11 @@ void _biblio_block_( switch (biblio_tag_name) { case "author_raw": // author_arr author (fn sn) j["author_arr"] = - split(header_tag_value, rgx.arr_delimiter); + header_tag_value.split(rgx.arr_delimiter); string tmp; biblioAuthorLoop: foreach (au; j["author_arr"].array) { - if (auto x = match(au.str, rgx.name_delimiter)) { + if (auto x = au.str.match(rgx.name_delimiter)) { tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", "; } else { tmp ~= au.str; @@ -2658,11 +2657,11 @@ void _biblio_block_( goto default; case "editor_raw": // editor_arr editor (fn sn) j["editor_arr"] = - split(header_tag_value, rgx.arr_delimiter); + header_tag_value.split(rgx.arr_delimiter); string tmp; biblioEditorLoop: foreach (ed; j["editor_arr"].array) { - if (auto x = match(ed.str, rgx.name_delimiter)) { + if (auto x = ed.str.match(rgx.name_delimiter)) { tmp ~= x.captures[2] ~ " " ~ x.captures[1] ~ ", "; } else { tmp ~= ed.str; @@ -2685,7 +2684,7 @@ void _biblio_block_( j[biblio_tag_name] ); } - if ((match(line, rgx.comment))) { + if (line.match(rgx.comment)) { writeln("ERROR", line, "COMMENT"); writeln("ERROR", s, "%%"); } @@ -2718,7 +2717,7 @@ void _group_block_(L,O,T)( } auto rgx = Rgx(); if (type["curly_group"] == State.on) { - if (matchFirst(line, rgx.block_curly_group_close)) { + if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { writeln(line); } @@ -2732,7 +2731,7 @@ void _group_block_(L,O,T)( an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } } else if (type["tic_group"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { debug(group) { writeln(line); } @@ -2765,7 +2764,7 @@ void _block_block_(L,O,T)( } auto rgx = Rgx(); if (type["curly_block"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_block_close)) { + if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close writeln(line); } @@ -2779,7 +2778,7 @@ void _block_block_(L,O,T)( an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } } else if (type["tic_block"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { debug(block) { writeln(line); } @@ -2820,7 +2819,7 @@ void _poem_block_(L,O,T,C,N,Ma)( } auto rgx = Rgx(); if (type["curly_poem"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_poem_close)) { + if (line.matchFirst(rgx.block_curly_poem_close)) { an_object[an_object_key]="verse"; debug(poem) { // poem (curly) close writefln( @@ -2856,7 +2855,7 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "verse"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2867,7 +2866,7 @@ void _poem_block_(L,O,T,C,N,Ma)( ++cntr; } obj_cite_number_poem["end"] = - to!string(obj_cite_number); + obj_cite_number.to!string; type["blocks"] = TriState.closing; type["poem"] = TriState.closing; type["curly_poem"] = TriState.off; @@ -2877,7 +2876,7 @@ void _poem_block_(L,O,T,C,N,Ma)( obj_cite_number = ocn_emit(type["ocn_status"]); type["verse_new"] = State.off; - } else if (matchFirst(line, rgx.newline_eol_delimiter_only)) { + } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { verse_line = TriState.off; type["verse_new"] = State.on; } @@ -2910,7 +2909,7 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "verse"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2922,7 +2921,7 @@ void _poem_block_(L,O,T,C,N,Ma)( } } } else if (type["tic_poem"] == TriState.on) { - if (auto m = matchFirst(line, rgx.block_tic_close)) { // tic_poem_close + if (auto m = line.matchFirst(rgx.block_tic_close)) { // tic_poem_close an_object[an_object_key]="verse"; debug(poem) { // poem (curly) close writefln( @@ -2949,13 +2948,13 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "verse"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - obj_cite_number_poem["end"] = to!string(obj_cite_number); + obj_cite_number_poem["end"] = obj_cite_number.to!string; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2969,7 +2968,7 @@ void _poem_block_(L,O,T,C,N,Ma)( obj_cite_number = ocn_emit(type["ocn_status"]); type["verse_new"] = State.off; - } else if (matchFirst(line, rgx.newline_eol_delimiter_only)) { + } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { type["verse_new"] = State.on; verse_line = TriState.off; } @@ -3003,7 +3002,7 @@ void _poem_block_(L,O,T,C,N,Ma)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "verse"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3034,7 +3033,7 @@ void _quote_block_(L,O,T)( } auto rgx = Rgx(); if (type["curly_quote"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_quote_close)) { + if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close writeln(line); } @@ -3048,7 +3047,7 @@ void _quote_block_(L,O,T)( an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } } else if (type["tic_quote"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { debug(quote) { // quote (tic) close writeln(line); } @@ -3081,7 +3080,7 @@ void _table_block_(L,O,T)( } auto rgx = Rgx(); if (type["curly_table"] == TriState.on) { - if (matchFirst(line, rgx.block_curly_table_close)) { + if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close writeln(line); } @@ -3095,7 +3094,7 @@ void _table_block_(L,O,T)( an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } } else if (type["tic_table"] == TriState.on) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { debug(table) { // table (tic) close writeln(line); } @@ -3177,7 +3176,7 @@ void _block_flag_line_empty_(B)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "group"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3223,7 +3222,7 @@ void _block_flag_line_empty_(B)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "block"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3270,7 +3269,7 @@ void _block_flag_line_empty_(B)( comp_obj_code.is_of = "block"; comp_obj_code.is_a = "code"; comp_obj_code.ocn = obj_cite_number; - comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_code.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_code.text = an_object["substantive"]; comp_obj_code.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3354,7 +3353,7 @@ void _block_flag_line_empty_(B)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "quote"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3401,7 +3400,7 @@ void _block_flag_line_empty_(B)( comp_obj_block.is_of = "block"; comp_obj_block.is_a = "table"; comp_obj_block.ocn = obj_cite_number; - comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + comp_obj_block.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; comp_obj_block.text = an_object["substantive"]; comp_obj_block.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3441,20 +3440,20 @@ auto _book_index_(L,I,O,T,B)( static assert(is(typeof(opt_action_bool) == bool[string])); } auto rgx = Rgx(); - if (auto m = match(line, rgx.book_index)) { + if (auto m = line.match(rgx.book_index)) { /+ match book_index +/ debug(bookindexmatch) { // book index writefln( "* [bookindex] %s\n", - to!string(m.captures[1]), + m.captures[1].to!string, ); } - an_object["bookindex_nugget"] = to!string(m.captures[1]); - } else if (auto m = match(line, rgx.book_index_open)) { + an_object["bookindex_nugget"] = m.captures[1].to!string; + } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ type["book_index"] = State.on; if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) { - book_idx_tmp = to!string(m.captures[1]); + book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { // book index writefln( "* [bookindex] %s\n", @@ -3464,11 +3463,11 @@ auto _book_index_(L,I,O,T,B)( } } else if (type["book_index"] == State.on ) { /+ book_index flag set +/ - if (auto m = match(line, rgx.book_index_close)) { + if (auto m = line.match(rgx.book_index_close)) { type["book_index"] = State.off; if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) { - an_object["bookindex_nugget"] = book_idx_tmp ~ to!string(m.captures[1]); + an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; debug(bookindexmatch) { // book index writefln( "* [bookindex] %s\n", @@ -3514,9 +3513,8 @@ auto _heading_found_(L,X,H,R,T)( writeln(dochead_make_identify_unmarked_headings); } char[][] make_headings_spl = - split( - cast(char[]) dochead_make_identify_unmarked_headings, - rgx.make_heading_delimiter); + (cast(char[]) dochead_make_identify_unmarked_headings) + .split(rgx.make_heading_delimiter); debug(headingsfound) { writeln(make_headings_spl.length); writeln(make_headings_spl); @@ -3525,7 +3523,7 @@ auto _heading_found_(L,X,H,R,T)( case 7 : if (!empty(make_headings_spl[6])) { heading_match_str["h_4"] = - "^(" ~ to!string(make_headings_spl[6]) ~ ")"; + "^(" ~ make_headings_spl[6].to!string ~ ")"; heading_match_rgx["h_4"] = regex(heading_match_str["h_4"]); } @@ -3533,7 +3531,7 @@ auto _heading_found_(L,X,H,R,T)( case 6 : if (!empty(make_headings_spl[5])) { heading_match_str["h_3"] = - "^(" ~ to!string(make_headings_spl[5]) ~ ")"; + "^(" ~ make_headings_spl[5].to!string ~ ")"; heading_match_rgx["h_3"] = regex(heading_match_str["h_3"]); } @@ -3541,7 +3539,7 @@ auto _heading_found_(L,X,H,R,T)( case 5 : if (!empty(make_headings_spl[4])) { heading_match_str["h_2"] = - "^(" ~ to!string(make_headings_spl[4]) ~ ")"; + "^(" ~ make_headings_spl[4].to!string ~ ")"; heading_match_rgx["h_2"] = regex(heading_match_str["h_2"]); } @@ -3549,7 +3547,7 @@ auto _heading_found_(L,X,H,R,T)( case 4 : if (!empty(make_headings_spl[3])) { heading_match_str["h_1"] = - "^(" ~ to!string(make_headings_spl[3]) ~ ")"; + "^(" ~ make_headings_spl[3].to!string ~ ")"; heading_match_rgx["h_1"] = regex(heading_match_str["h_1"]); } @@ -3557,7 +3555,7 @@ auto _heading_found_(L,X,H,R,T)( case 3 : if (!empty(make_headings_spl[2])) { heading_match_str["h_D"] = - "^(" ~ to!string(make_headings_spl[2]) ~ ")"; + "^(" ~ make_headings_spl[2].to!string ~ ")"; heading_match_rgx["h_D"] = regex(heading_match_str["h_D"]); } @@ -3565,7 +3563,7 @@ auto _heading_found_(L,X,H,R,T)( case 2 : if (!empty(make_headings_spl[1])) { heading_match_str["h_C"] = - "^(" ~ to!string(make_headings_spl[1]) ~ ")"; + "^(" ~ make_headings_spl[1].to!string ~ ")"; heading_match_rgx["h_C"] = regex(heading_match_str["h_C"]); } @@ -3573,7 +3571,7 @@ auto _heading_found_(L,X,H,R,T)( case 1 : if (!empty(make_headings_spl[0])) { heading_match_str["h_B"] = - "^(" ~ to!string(make_headings_spl[0]) ~ ")"; + "^(" ~ make_headings_spl[0].to!string ~ ")"; heading_match_rgx["h_B"] = regex(heading_match_str["h_B"]); } @@ -3608,43 +3606,43 @@ auto _heading_make_set_(L,C,R,T)( && ((type["para"] == State.off) && (type["heading"] == State.off))) { /+ heading make set +/ - if (matchFirst(line, heading_match_rgx["h_B"])) { + if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_C"])) { + if (line.matchFirst(heading_match_rgx["h_C"])) { line = "C~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_D"])) { + if (line.matchFirst(heading_match_rgx["h_D"])) { line = "D~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_1"])) { + if (line.matchFirst(heading_match_rgx["h_1"])) { line = "1~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_2"])) { + if (line.matchFirst(heading_match_rgx["h_2"])) { line = "2~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_3"])) { + if (line.matchFirst(heading_match_rgx["h_3"])) { line = "3~ " ~ line; debug(headingsfound) { writeln(line); } } - if (matchFirst(line, heading_match_rgx["h_4"])) { + if (line.matchFirst(heading_match_rgx["h_4"])) { line = "4~ " ~ line; debug(headingsfound) { writeln(line); @@ -3679,10 +3677,10 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( static assert(is(typeof(dochead_meta_aa) == string[string][string])); } auto rgx = Rgx(); - if (auto m = match(line, rgx.heading)) { + if (auto m = line.match(rgx.heading)) { /+ heading match +/ type["heading"] = State.on; - if (match(line, rgx.heading_seg_and_above)) { + if (line.match(rgx.heading_seg_and_above)) { type["biblio_section"] = State.off; type["glossary_section"] = State.off; type["blurb_section"] = State.off; @@ -3701,7 +3699,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( dochead_meta_aa["creator"]["author"]); collapsed_lev["h0"] = 0; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h0"]); + collapsed_lev["h0"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_A; ++lv["h0"]; lv["h1"] = State.off; @@ -3715,7 +3713,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "B": collapsed_lev["h1"] = collapsed_lev["h0"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h1"]); + collapsed_lev["h1"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_B; ++lv["h1"]; lv["h2"] = State.off; @@ -3728,7 +3726,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "C": collapsed_lev["h2"] = collapsed_lev["h1"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h2"]); + collapsed_lev["h2"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_C; ++lv["h2"]; lv["h3"] = State.off; @@ -3740,7 +3738,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "D": collapsed_lev["h3"] = collapsed_lev["h2"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h3"]); + collapsed_lev["h3"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_D; ++lv["h3"]; lv["h4"] = State.off; @@ -3759,7 +3757,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( collapsed_lev["h4"] = collapsed_lev["h0"] + 1; } an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h4"]); + collapsed_lev["h4"].to!string; lv["lv"] = DocStructMarkupHeading.h_text_1; ++lv["h4"]; lv["h5"] = State.off; @@ -3769,11 +3767,11 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "2": if (lv["h5"] > State.off) { an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h5"]); + collapsed_lev["h5"].to!string; } else if (lv["h4"] > State.off) { collapsed_lev["h5"] = collapsed_lev["h4"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h5"]); + collapsed_lev["h5"].to!string; } lv["lv"] = DocStructMarkupHeading.h_text_2; ++lv["h5"]; @@ -3783,11 +3781,11 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "3": if (lv["h6"] > State.off) { an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h6"]); + collapsed_lev["h6"].to!string; } else if (lv["h5"] > State.off) { collapsed_lev["h6"] = collapsed_lev["h5"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h6"]); + collapsed_lev["h6"].to!string; } lv["lv"] = DocStructMarkupHeading.h_text_3; ++lv["h6"]; @@ -3796,20 +3794,20 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( case "4": if (lv["h7"] > State.off) { an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h7"]); + collapsed_lev["h7"].to!string; } else if (lv["h6"] > State.off) { collapsed_lev["h7"] = collapsed_lev["h6"] + 1; an_object["lev_collapsed_number"] = - to!string(collapsed_lev["h7"]); + collapsed_lev["h7"].to!string; } lv["lv"] = DocStructMarkupHeading.h_text_4; ++lv["h7"]; goto default; default: - an_object["lev_markup_number"] = to!string(lv["lv"]); + an_object["lev_markup_number"] = lv["lv"].to!string; } debug(heading) { // heading - writeln(strip(line)); + writeln(line.strip); } } } @@ -3848,31 +3846,31 @@ void _para_match_(L,O,K,I,B,T,C)( "base_position" : 0, ]; bullet = false; - if (auto m = matchFirst(line, rgx.para_indent)) { + if (auto m = line.matchFirst(rgx.para_indent)) { debug(paraindent) { // para indent writeln(line); } - indent["hang_position"] = to!int(m.captures[1]); + indent["hang_position"] = (m.captures[1]).to!int; indent["base_position"] = 0; - } else if (matchFirst(line, rgx.para_bullet)) { + } else if (line.matchFirst(rgx.para_bullet)) { debug(parabullet) { // para bullet writeln(line); } bullet = true; - } else if (auto m = matchFirst(line, rgx.para_indent_hang)) { + } else if (auto m = line.matchFirst(rgx.para_indent_hang)) { debug(paraindenthang) { // para indent hang writeln(line); } indent=[ - "hang_position" : to!int(m.captures[1]), - "base_position" : to!int(m.captures[2]), + "hang_position" : (m.captures[1]).to!int, + "base_position" : (m.captures[2]).to!int, ]; - } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) { + } else if (auto m = line.matchFirst(rgx.para_bullet_indent)) { debug(parabulletindent) { // para bullet indent writeln(line); } indent=[ - "hang_position" : to!int(m.captures[1]), + "hang_position" : (m.captures[1]).to!int, "base_position" : 0, ]; bullet = true; @@ -3890,7 +3888,7 @@ auto font_faces_line(T)( return ref T textline, ) { auto rgx = Rgx(); - if (match(textline, rgx.inline_faces_line)) { + if (textline.match(rgx.inline_faces_line)) { textline = (textline) .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) .replaceFirst(rgx.inline_bold_line, ("!{$1}!$2")) @@ -3958,9 +3956,9 @@ struct ObjInlineMarkupMunge { static assert(is(typeof(obj_txt_in) == string)); } /+ url matched +/ - if (match(obj_txt_in, rgx.inline_url_generic)) { + if (obj_txt_in.match(rgx.inline_url_generic)) { /+ link: naked url: http://url +/ - if (match(obj_txt_in, rgx.inline_link_naked_url)) { + if (obj_txt_in.match(rgx.inline_link_naked_url)) { obj_txt_in = (obj_txt_in).replaceAll( rgx.inline_link_naked_url, ("$1" @@ -3974,7 +3972,7 @@ struct ObjInlineMarkupMunge { maps to: { link which includes url as footnote }http://url~{ { http://url }http://url }~ +/ - if (match(obj_txt_in, rgx.inline_link_endnote_url_helper)) { + if (obj_txt_in.match(rgx.inline_link_endnote_url_helper)) { obj_txt_in = (obj_txt_in).replaceAll( rgx.inline_link_endnote_url_helper_punctuated, (mkup.lnk_o ~ "$1" ~ mkup.lnk_c @@ -3995,7 +3993,7 @@ struct ObjInlineMarkupMunge { /+ link with regular markup: { linked text or image }http://url +/ - if (match(obj_txt_in, rgx.inline_link_markup_regular)) { + if (obj_txt_in.match(rgx.inline_link_markup_regular)) { obj_txt_in = (obj_txt_in).replaceAll( rgx.inline_link_markup_regular, ("$1" @@ -4027,8 +4025,8 @@ struct ObjInlineMarkupMunge { if (!(stage_reset_note_numbers) && reset_note_numbers) { stage_reset_note_numbers = true; } - if (match(obj_txt_in, rgx.inline_notes_al_gen)) { - if (auto m = matchAll(obj_txt_in, rgx.inline_text_and_note_al_)) { + if (obj_txt_in.match(rgx.inline_notes_al_gen)) { + if (auto m = obj_txt_in.matchAll(rgx.inline_text_and_note_al_)) { if (stage_reset_note_numbers) { n_foot = 0; n_foot_reg = 0; @@ -4037,25 +4035,25 @@ struct ObjInlineMarkupMunge { } stage_reset_note_numbers = false; foreach(n; m) { - if (match(to!string(n.hit), rgx.inline_al_delimiter_open_symbol_star)) { + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { flg_notes_star = true; ++n_foot_sp_asterisk; asterisks_ = "*"; n_foot=n_foot_sp_asterisk; - obj_txt_out ~= (to!string(n.hit)).replaceFirst( + obj_txt_out ~= n.hit.to!string.replaceFirst( rgx.inline_al_delimiter_open_symbol_star, (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") ) ~ "\n"; - } else if (match(to!string(n.hit), rgx.inline_al_delimiter_open_regular)) { + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_regular)) { flg_notes_reg = true; ++n_foot_reg; n_foot=n_foot_reg; - obj_txt_out ~= (to!string(n.hit)).replaceFirst( + obj_txt_out ~= n.hit.to!string.replaceFirst( rgx.inline_al_delimiter_open_regular, (mkup.en_a_o ~ to!string(n_foot) ~ " ") ) ~ "\n"; } else { - obj_txt_out ~= to!string(n.hit) ~ "\n"; + obj_txt_out ~= n.hit.to!string ~ "\n"; } } } @@ -4086,19 +4084,16 @@ struct ObjInlineMarkupMunge { bool urls = false; tail = ""; /+ special endnotes +/ - obj_txt_in = replaceAll( - obj_txt_in, + obj_txt_in = obj_txt_in.replaceAll( rgx.inline_notes_curly_sp_asterisk, (mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c) ); - obj_txt_in = - replaceAll( - obj_txt_in, - rgx.inline_notes_curly_sp_plus, - (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) - ); + obj_txt_in = obj_txt_in.replaceAll( + rgx.inline_notes_curly_sp_plus, + (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) + ); /+ url matched +/ - if (match(obj_txt_in, rgx.inline_url)) { + if (obj_txt_in.match(rgx.inline_url)) { urls = true; obj_txt_in = url_links(obj_txt_in); } @@ -4116,7 +4111,7 @@ struct ObjInlineMarkupMunge { } } auto t = tuple( - to!string(obj_txt_out), + obj_txt_out, ftn[1], ftn[2], urls, @@ -4155,7 +4150,7 @@ struct ObjInlineMarkupMunge { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); - writeln(to!string(obj_txt["munge"])); + writeln(obj_txt["munge"].to!string); } return t; } @@ -4188,7 +4183,7 @@ struct ObjInlineMarkupMunge { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); - writeln(to!string(obj_txt["munge"])); + writeln(obj_txt["munge"].to!string); } return t; } @@ -4385,7 +4380,7 @@ struct ObjInlineMarkup { } body { obj_txt["munge"] = obj_[obj_key_].dup; - obj_txt["munge"] = (match(obj_["is"], ctRegex!(`verse|code`))) + obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] : strip(obj_txt["munge"]); static __gshared string[] anchor_tags_ = []; @@ -4400,7 +4395,7 @@ struct ObjInlineMarkup { // TODO WORK ON, you still need to ensure that level 1 anchor_tags are unique obj_txt["munge"]=_configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, dochead_make_aa); obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]); - if (auto m = match(obj_txt["munge"], rgx.heading_anchor_tag)) { + if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { anchor_tag = m.captures[1]; anchor_tags_ ~= anchor_tag; } else if (obj_["lev"] == "1") { @@ -4468,7 +4463,7 @@ struct ObjInlineMarkup { debug(asserts) { static assert(is(typeof(heading_toc_) == char[])); } - auto m = matchFirst(cast(char[]) heading_toc_, rgx.heading); + auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, ""); @@ -4501,10 +4496,10 @@ struct ObjInlineMarkup { auto attrib=""; string toc_txt_, subtoc_txt_; int[string] indent; - if (to!int(obj_["lev_markup_number"]) > 0) { + if (obj_["lev_markup_number"].to!int > 0) { indent=[ - "hang_position" : to!int(obj_["lev_markup_number"]), - "base_position" : to!int(obj_["lev_markup_number"]), + "hang_position" : obj_["lev_markup_number"].to!int, + "base_position" : obj_["lev_markup_number"].to!int, ]; toc_txt_ = format( "{ %s }#%s", @@ -4521,7 +4516,7 @@ struct ObjInlineMarkup { comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; comp_obj_toc.bullet = false; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["scroll"] ~= comp_obj_toc; } else { @@ -4550,7 +4545,7 @@ struct ObjInlineMarkup { comp_obj_toc.obj_cite_number = ""; comp_obj_toc.bullet = false; comp_obj_toc.inline_links = true; - switch (to!int(obj_["lev_markup_number"])) { + switch (obj_["lev_markup_number"].to!int) { case 0: indent=[ "hang_position" : 0, @@ -4560,14 +4555,14 @@ struct ObjInlineMarkup { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; break; case 1: .. case 3: indent=[ - "hang_position" : to!int(obj_["lev_markup_number"]), - "base_position" : to!int(obj_["lev_markup_number"]), + "hang_position" : obj_["lev_markup_number"].to!int, + "base_position" : obj_["lev_markup_number"].to!int, ]; toc_txt_ = format( "%s", @@ -4576,7 +4571,7 @@ struct ObjInlineMarkup { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; break; @@ -4591,12 +4586,12 @@ struct ObjInlineMarkup { lev4_subtoc[segment_anchor_tag_that_object_belongs_to] = []; toc_txt_= munge.url_links(toc_txt_); indent=[ - "hang_position" : to!int(obj_["lev_markup_number"]), - "base_position" : to!int(obj_["lev_markup_number"]), + "hang_position" : obj_["lev_markup_number"].to!int, + "base_position" : obj_["lev_markup_number"].to!int, ]; comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; break; @@ -4615,15 +4610,15 @@ struct ObjInlineMarkup { _anchor_tag, ); lev4_subtoc[segment_anchor_tag_that_object_belongs_to] - ~= obj_["lev_markup_number"] ~ "~ " ~ to!string(subtoc_txt_).strip; + ~= obj_["lev_markup_number"] ~ "~ " ~ subtoc_txt_.to!string.strip; toc_txt_= munge.url_links(toc_txt_); indent=[ - "hang_position" : to!int(obj_["lev_markup_number"]), - "base_position" : to!int(obj_["lev_markup_number"]), + "hang_position" : obj_["lev_markup_number"].to!int, + "base_position" : obj_["lev_markup_number"].to!int, ]; comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; - comp_obj_toc.text = to!string(toc_txt_).strip; + comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.inline_links = true; the_table_of_contents_section["seg"] ~= comp_obj_toc; break; @@ -4667,7 +4662,7 @@ private: static __gshared string heading_number_auto_composite = ""; if (heading_num_top_level==9) { if (dochead_make_aa["make"]["num_depth"].length > 0) { - heading_num_depth = to!uint(dochead_make_aa["make"]["num_depth"]); + heading_num_depth = dochead_make_aa["make"]["num_depth"].to!uint; } switch (dochead_make_aa["make"]["num_top"]) { case "A": @@ -4700,7 +4695,7 @@ private: /+ num_depth minimum 0 (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ if ( heading_num_top_level - > to!uint(obj_["lev_markup_number"]) + > obj_["lev_markup_number"].to!uint ) { heading_num_0 = 0; heading_num_1 = 0; @@ -4708,7 +4703,7 @@ private: heading_num_3 = 0; } else if ( heading_num_top_level - == to!uint(obj_["lev_markup_number"]) + == obj_["lev_markup_number"].to!uint ) { heading_num_0 ++; heading_num_1 = 0; @@ -4716,54 +4711,54 @@ private: heading_num_3 = 0; } else if ( heading_num_top_level - == (to!uint(obj_["lev_markup_number"]) - 1) + == (obj_["lev_markup_number"].to!uint - 1) ) { heading_num_1 ++; heading_num_2 = 0; heading_num_3 = 0; } else if ( heading_num_top_level - == (to!uint(obj_["lev_markup_number"]) - 2) + == (obj_["lev_markup_number"].to!uint - 2) ) { heading_num_2 ++; heading_num_3 = 0; } else if ( heading_num_top_level - == (to!uint(obj_["lev_markup_number"]) - 3) + == (obj_["lev_markup_number"].to!uint - 3) ) { heading_num_3 ++; } if (heading_num_3 > 0) { heading_number_auto_composite = (heading_num_depth == 3) - ? ( to!string(heading_num_0) ~ "." - ~ to!string(heading_num_1) ~ "." - ~ to!string(heading_num_2) ~ "." - ~ to!string(heading_num_3) + ? ( heading_num_0.to!string ~ "." + ~ heading_num_1.to!string ~ "." + ~ heading_num_2.to!string ~ "." + ~ heading_num_3.to!string ) : ""; } else if (heading_num_2 > 0) { heading_number_auto_composite = ((heading_num_depth >= 2) && (heading_num_depth <= 3)) - ? ( to!string(heading_num_0) ~ "." - ~ to!string(heading_num_1) ~ "." - ~ to!string(heading_num_2) + ? ( heading_num_0.to!string ~ "." + ~ heading_num_1.to!string ~ "." + ~ heading_num_2.to!string ) : ""; } else if (heading_num_1 > 0) { heading_number_auto_composite = ((heading_num_depth >= 1) && (heading_num_depth <= 3)) - ? ( to!string(heading_num_0) ~ "." - ~ to!string(heading_num_1) + ? ( heading_num_0.to!string ~ "." + ~ heading_num_1.to!string ) : ""; } else if (heading_num_0 > 0) { heading_number_auto_composite = ((heading_num_depth >= 0) && (heading_num_depth <= 3)) - ? (to!string(heading_num_0)) + ? (heading_num_0.to!string) : ""; } else { heading_number_auto_composite = ""; @@ -4771,7 +4766,7 @@ private: debug(heading_number_auto) { writeln(heading_number_auto_composite); } - if (!(match(munge_, rgx.heading_anchor_tag)) + if (!(munge_.match(rgx.heading_anchor_tag)) && !empty(heading_number_auto_composite)) { munge_=(munge_) .replaceFirst(rgx.heading, @@ -4800,13 +4795,13 @@ private: static assert(is(typeof(munge_) == string)); static assert(is(typeof(lev_) == string)); } - if (!(match(munge_, rgx.heading_anchor_tag))) { // if (anchor_tags_.length == 0) { - if (match(munge_, rgx.heading_identify_anchor_tag)) { - if (auto m = match(munge_, rgx.heading_extract_named_anchor_tag)) { + if (!(munge_.match(rgx.heading_anchor_tag))) { + if (munge_.match(rgx.heading_identify_anchor_tag)) { + if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, - "$1~" ~ toLower(m.captures[1]) ~ "_" ~ m.captures[2] ~ " "); - } else if (auto m = match(munge_, rgx.heading_extract_unnamed_anchor_tag)) { + "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); + } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ "s" ~ m.captures[1] ~ " "); @@ -4816,7 +4811,7 @@ private: heading_num_lev1 ++; munge_=(munge_).replaceFirst( rgx.heading_marker_missing_tag, - "$1~" ~ "x" ~ to!string(heading_num_lev1) ~ " "); + "$1~" ~ "x" ~ heading_num_lev1.to!string ~ " "); } } return munge_; @@ -4984,22 +4979,22 @@ struct ObjAttributes { } } body { - if (matchFirst(obj_txt_in, rgx.para_bullet)) { + if (obj_txt_in.matchFirst(rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," ~ " \"indent_hang\": 0," ~ " \"indent_base\": 0,"; - } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) { + } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; - } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) { + ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," + ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ","; + } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_base\": " ~ to!string(m.captures[2]) ~ ","; - } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) { + ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," + ~ " \"indent_base\": " ~ m.captures[2].to!string ~ ","; + } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ to!string(m.captures[1]) ~ "," - ~ " \"indent_base\": " ~ to!string(m.captures[1]) ~ ","; + ~ " \"indent_hang\": " ~ m.captures[1].to!string ~ "," + ~ " \"indent_base\": " ~ m.captures[1].to!string ~ ","; } else { _obj_attributes =" \"bullet\": \"false\"," ~ " \"indent_hang\": 0," @@ -5256,7 +5251,7 @@ struct BookIndexNuggetHash { if (!bookindex_section.empty) { writeln( "* [bookindex] ", - "[", to!string(obj_cite_number), ": ", segment_anchor_tag, "] ", bookindex_section + "[", obj_cite_number.to!string, ": ", segment_anchor_tag, "] ", bookindex_section ); } } @@ -5265,41 +5260,39 @@ struct BookIndexNuggetHash { auto rgx = Rgx(); if (!bookindex_section.empty) { auto bi_main_terms_split_arr = - split(bookindex_section, rgx.bi_main_terms_split); + bookindex_section.split(rgx.bi_main_terms_split); foreach (bi_main_terms_content; bi_main_terms_split_arr) { auto bi_main_term_and_rest = - split(bi_main_terms_content, rgx.bi_main_term_plus_rest_split); - if (auto m = match( - bi_main_term_and_rest[0], + bi_main_terms_content.split(rgx.bi_main_term_plus_rest_split); + if (auto m = bi_main_term_and_rest[0].match( rgx.bi_term_and_obj_cite_numbers_match) ) { - main_term = strip(m.captures[1]); - obj_cite_number_offset = to!int(m.captures[2]); + main_term = m.captures[1].strip; + obj_cite_number_offset = m.captures[2].to!int; obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); - obj_cite_numbers ~= (to!string(obj_cite_number) ~ "-" ~ to!string(obj_cite_number_endpoint) + obj_cite_numbers ~= (obj_cite_number.to!string ~ "-" ~ to!string(obj_cite_number_endpoint) ~ ":" ~ segment_anchor_tag); } else { - main_term = strip(bi_main_term_and_rest[0]); - obj_cite_numbers ~= to!string(obj_cite_number) + main_term = bi_main_term_and_rest[0].strip; + obj_cite_numbers ~= obj_cite_number.to!string ~ ":" ~ segment_anchor_tag; } bi[main_term]["_a"] ~= obj_cite_numbers; obj_cite_numbers=null; if (bi_main_term_and_rest.length > 1) { auto bi_sub_terms_split_arr = - split( - bi_main_term_and_rest[1], + bi_main_term_and_rest[1].split( rgx.bi_sub_terms_plus_obj_cite_number_offset_split ); foreach (sub_terms_bits; bi_sub_terms_split_arr) { - if (auto m = match(sub_terms_bits, rgx.bi_term_and_obj_cite_numbers_match)) { - sub_term = strip(m.captures[1]); - obj_cite_number_offset = to!int(m.captures[2]); + if (auto m = sub_terms_bits.match(rgx.bi_term_and_obj_cite_numbers_match)) { + sub_term = m.captures[1].strip; + obj_cite_number_offset = m.captures[2].to!int; obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); - obj_cite_numbers ~= (to!string(obj_cite_number) ~ " - " ~ to!string(obj_cite_number_endpoint) + obj_cite_numbers ~= (obj_cite_number.to!string ~ " - " ~ to!string(obj_cite_number_endpoint) ~ ":" ~ segment_anchor_tag); } else { - sub_term = strip(sub_terms_bits); + sub_term = sub_terms_bits.strip; obj_cite_numbers ~= to!string(obj_cite_number) ~ ":" ~ segment_anchor_tag; } @@ -5480,7 +5473,7 @@ struct BookIndexReportSection { bi_tmp_seg = "!{" ~ mainkey ~ "}! "; auto bkidx_lnk_seg(string locs) { string markup = ""; - if (auto m = matchFirst(locs, rgx.book_index_go_seg)) { + if (auto m = locs.matchFirst(rgx.book_index_go_seg)) { markup = munge.url_links("{ " ~ m["link"] ~ " }" ~ mkup.mark_internal_site_lnk ~ m["seg"] ~ ".fnSuffix" @@ -5492,7 +5485,7 @@ struct BookIndexReportSection { } auto bkidx_lnk_scroll(string locs) { string markup = ""; - if (auto m = matchFirst(locs, rgx.book_index_go)) { + if (auto m = locs.matchFirst(rgx.book_index_go)) { markup = munge.url_links("{ " ~ m["link"] ~ " }" ~ mkup.mark_internal_site_lnk @@ -5530,7 +5523,7 @@ struct BookIndexReportSection { comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; comp_obj_para.is_a = "bookindex"; - comp_obj_para.text = to!string(bi_tmp_scroll).strip; + comp_obj_para.text = bi_tmp_scroll.to!string.strip; comp_obj_para.ocn = obj_cite_number; comp_obj_para.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); comp_obj_para.anchor_tags = bi_tmp_tags; @@ -5539,7 +5532,7 @@ struct BookIndexReportSection { comp_obj_para.bullet = false; comp_obj_para.inline_links = true; bookindex_section["scroll"] ~= comp_obj_para; - comp_obj_para.text = to!string(bi_tmp_seg).strip; + comp_obj_para.text = bi_tmp_seg.to!string.strip; bookindex_section["seg"] ~= comp_obj_para; ++obj_cite_number; ++mkn; @@ -5596,7 +5589,7 @@ struct NotesSection { assert(cntr >= previous_count); previous_count=cntr; assert( - match(contents_am[cntr].text, + (contents_am[cntr].text).match( rgx.inline_notes_delimiter_al_regular_number_note) ); } @@ -5606,8 +5599,7 @@ struct NotesSection { auto munge = ObjInlineMarkupMunge(); foreach( m; - matchAll( - contents_am[cntr].text, + (contents_am[cntr].text).matchAll( rgx.inline_notes_delimiter_al_regular_number_note ) ) { @@ -5650,8 +5642,8 @@ struct NotesSection { body { string[][string] endnotes_; if (object_notes.length > 1) { - endnotes_["notes"] = (split(object_notes["notes"], rgx.break_string))[0..$-1]; - endnotes_["anchor"] = (split(object_notes["anchor"], rgx.break_string))[0..$-1]; + endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; + endnotes_["anchor"] = (object_notes["anchor"].split(rgx.break_string))[0..$-1]; } else { endnotes_["notes"] = []; endnotes_["anchor"] = []; @@ -5740,8 +5732,8 @@ struct NotesSection { comp_obj_endnote_.indent_base = 0; comp_obj_endnote_.bullet = false; foreach (i, endnote; endnotes_["notes"]) { - auto m = (matchFirst(endnote, rgx.note_ref)); - string notenumber = to!string(m.captures[1]); + auto m = endnote.matchFirst(rgx.note_ref); + string notenumber = m.captures[1].to!string; string anchor_tag = "note_" ~ notenumber; comp_obj_endnote_.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.inline_links = true; @@ -5930,12 +5922,12 @@ struct NodeStructureMetadata { static assert(is(typeof(is_) == string)); } assert(is_ != "heading"); - assert(to!int(obj_cite_number_) >= 0); + assert(obj_cite_number_.to!int >= 0); } body { assert(is_ != "heading"); // should not be necessary - assert(to!int(obj_cite_number_) >= 0); // should not be necessary - int obj_cite_number=to!int(obj_cite_number_); + assert(obj_cite_number_.to!int >= 0); // should not be necessary + int obj_cite_number = obj_cite_number_.to!int; if (lv7 > State.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; p_["obj_cite_number"] = lv7; @@ -5953,14 +5945,14 @@ struct NodeStructureMetadata { comp_obj_location = comp_obj_location.init; comp_obj_location.is_a = is_; comp_obj_location.ocn = obj_cite_number_; - comp_obj_location.segment_anchor_tag = to!string(segment_anchor_tag); + comp_obj_location.segment_anchor_tag = segment_anchor_tag.to!string; comp_obj_location.parent_ocn = p_["obj_cite_number"]; comp_obj_location.parent_lev_markup = p_["lev_markup_number"]; debug(node) { - if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("x ", to!string(_node)); + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("x ", _node.to!string); } else { - writeln("- ", to!string(_node)); + writeln("- ", _node.to!string); } } assert(comp_obj_location.parent_lev_markup >= 4); @@ -6009,18 +6001,18 @@ struct NodeStructureMetadata { assert(is_ == "heading"); assert(to!int(obj_cite_number_) >= 0); assert( - match(lev_markup_number, rgx.levels_numbered), - ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ to!string(obj_cite_number_)) + lev_markup_number.match(rgx.levels_numbered), + ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_number_.to!string) ); - if (match(lev_markup_number, rgx.levels_numbered)) { - if (to!int(lev_markup_number) == 0) { - assert(to!int(obj_cite_number_) == 1); + if (lev_markup_number.match(rgx.levels_numbered)) { + if (lev_markup_number.to!int == 0) { + assert(obj_cite_number_.to!int == 1); } } } body { - int obj_cite_number = to!int(obj_cite_number_); - switch (to!int(lev_markup_number)) { + int obj_cite_number = obj_cite_number_.to!int; + switch (lev_markup_number.to!int) { case 0: lv = DocStructMarkupHeading.h_sect_A; lv0 = obj_cite_number; @@ -6105,13 +6097,13 @@ struct NodeStructureMetadata { _comp_obj_heading_.use = "body"; _comp_obj_heading_.is_of = "para"; _comp_obj_heading_.is_a = "heading"; - _comp_obj_heading_.text = to!string(_text).strip; + _comp_obj_heading_.text = _text.to!string.strip; _comp_obj_heading_.ocn = obj_cite_number_; - _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag); + _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : obj_cite_number.to!string; + _comp_obj_heading_.segment_anchor_tag = segment_anchor_tag.to!string; _comp_obj_heading_.marked_up_level = lev; - _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0); - _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0); + _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); + _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? lev_collapsed_number.to!int : 0); _comp_obj_heading_.parent_ocn = p_["obj_cite_number"]; _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"]; _comp_obj_heading_.heading_ancestors_text = lv_ancestors; @@ -6122,18 +6114,18 @@ struct NodeStructureMetadata { _comp_obj_heading_.inline_notes_star = flag_notes_star; _comp_obj_heading_.inline_links = flag_links; debug(node) { - if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(_node)); + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("* ", _node.to!string); } } debug(nodeheading) { - if (match(lev_markup_number, rgx.levels_numbered_headings)) { - writeln("* ", to!string(_node)); + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("* ", _node.to!string); } } assert(_comp_obj_heading_.parent_lev_markup <= 7); assert(_comp_obj_heading_.parent_ocn >= 0); - if (match(lev_markup_number, rgx.levels_numbered_headings)) { + if (lev_markup_number.match(rgx.levels_numbered_headings)) { assert(_comp_obj_heading_.heading_lev_markup <= 7); assert(_comp_obj_heading_.ocn >= 0); if (_comp_obj_heading_.parent_lev_markup > 0) { @@ -6263,7 +6255,7 @@ auto assertions_doc_structure(O,Lv)( } if (lv["h7"] == State.off) { } - switch (to!string(an_object["lev"])) { + switch ((an_object["lev"]).to!string) { case "A": if (lv["h0"] == State.off) { assert(lv["h1"] == State.off); diff --git a/org/ao_read_source_files.org b/org/ao_read_source_files.org index a870a57..fa3da1a 100644 --- a/org/ao_read_source_files.org +++ b/org/ao_read_source_files.org @@ -55,7 +55,7 @@ final string ConfigIn(C,E)(C conf_sdl, E env) { debug(configfile) { writeln(conf_file); } - config_file_str = readText(conf_file); + config_file_str = conf_file.readText; break; } } @@ -193,7 +193,7 @@ template SiSUrawMarkupContent() { raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); auto header_raw = t[0]; auto sourcefile_body_content = t[1]; - if (match(fn_src, rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise + if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); auto tu = ins.scan_master_src_for_insert_files_and_import_content(sourcefile_body_content, fn_src); @@ -260,7 +260,7 @@ final private string readInMarkupSource(in char[] fn_src) { string source_txt_str; try { if (exists(fn_src)) { - source_txt_str = readText(fn_src); + source_txt_str = fn_src.readText; } } catch (ErrnoException ex) { @@ -292,12 +292,13 @@ split is on first match of level A~ (which is required) final private char[][] header0Content1(in string src_text) { /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; - auto m = matchFirst(cast(char[]) src_text, rgx.heading_a); + auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); header_and_content ~= m.pre; header_and_content ~= m.hit ~ m.post; assert(header_and_content.length == 2, - "document markup is broken, header body split == " ~ to!string(header_and_content.length) ~ - "; (header / body array split should == 2 (split is on level A~))" + "document markup is broken, header body split == " + ~ header_and_content.length.to!string + ~ "; (header / body array split should == 2 (split is on level A~))" ); return header_and_content; } @@ -309,7 +310,7 @@ final private char[][] header0Content1(in string src_text) { #+BEGIN_SRC d final private char[][] markupSourceLineArray(in char[] src_text) { char[][] source_line_arr = - split(cast(char[]) src_text, rgx.newline_eol_strip_preceding); + (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; } #+END_SRC @@ -325,7 +326,7 @@ final private char[][] markupSourceLineArray(in char[] src_text) { auto markupSourceReadIn(in string fn_src) { auto rgx = Rgx(); enforce( - match(fn_src, rgx.src_pth), + fn_src.match(rgx.src_pth), "not a sisu markup filename" ); auto source_txt_str = readInMarkupSource(fn_src); @@ -361,7 +362,7 @@ final char[][] getInsertMarkupSourceContentRawLineArray( Regex!(char) rgx_file ) { enforce( - match(fn_src, rgx_file), + fn_src.match(rgx_file), "not a sisu markup filename" ); auto source_txt_str = readInMarkupSource(fn_src); @@ -380,7 +381,7 @@ final char[][] getInsertMarkupSourceContentRawLineArray( #+BEGIN_SRC d char[][] contents_insert; auto type1 = flags_type_init; -auto fn_pth_full = match(fn_src, rgx.src_pth); +auto fn_pth_full = fn_src.match(rgx.src_pth); auto markup_src_file_path = fn_pth_full.captures[1]; #+END_SRC @@ -391,11 +392,11 @@ auto markup_src_file_path = fn_pth_full.captures[1]; if (type1["curly_code"] == 1) { type1["header_make"] = 0; type1["header_meta"] = 0; - if (matchFirst(line, rgx.block_curly_code_close)) { + if (line.matchFirst(rgx.block_curly_code_close)) { type1["curly_code"] = 0; } contents_insert ~= line; -} else if (matchFirst(line, rgx.block_curly_code_open)) { +} else if (line.matchFirst(rgx.block_curly_code_open)) { type1["curly_code"] = 1; type1["header_make"] = 0; type1["header_meta"] = 0; @@ -403,28 +404,28 @@ if (type1["curly_code"] == 1) { } else if (type1["tic_code"] == 1) { type1["header_make"] = 0; type1["header_meta"] = 0; - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { type1["tic_code"] = 0; } contents_insert ~= line; -} else if (matchFirst(line, rgx.block_tic_code_open)) { +} else if (line.matchFirst(rgx.block_tic_code_open)) { type1["tic_code"] = 1; type1["header_make"] = 0; type1["header_meta"] = 0; contents_insert ~= line; } else if ( (type1["header_make"] == 1) - && matchFirst(line, rgx.native_header_sub) + && line.matchFirst(rgx.native_header_sub) ) { type1["header_make"] = 1; type1["header_meta"] = 0; } else if ( (type1["header_meta"] == 1) - && matchFirst(line, rgx.native_header_sub) + && line.matchFirst(rgx.native_header_sub) ) { type1["header_meta"] = 1; type1["header_make"] = 0; -} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { type1["header_make"] = 0; type1["header_meta"] = 0; auto insert_fn = m.captures[2]; @@ -474,7 +475,7 @@ return contents_insert; #+BEGIN_SRC d char[][] contents; auto type = flags_type_init; -auto fn_pth_full = match(fn_src, rgx.src_pth); +auto fn_pth_full = fn_src.match(rgx.src_pth); auto markup_src_file_path = fn_pth_full.captures[1]; string[] insert_file_list =[]; #+END_SRC @@ -484,22 +485,22 @@ string[] insert_file_list =[]; #+name: ao_master_doc_scan_for_insert_filenames_loop #+BEGIN_SRC d if (type["curly_code"] == 1) { - if (matchFirst(line, rgx.block_curly_code_close)) { + if (line.matchFirst(rgx.block_curly_code_close)) { type["curly_code"] = 0; } contents ~= line; -} else if (matchFirst(line, rgx.block_curly_code_open)) { +} else if (line.matchFirst(rgx.block_curly_code_open)) { type["curly_code"] = 1; contents ~= line; } else if (type["tic_code"] == 1) { - if (matchFirst(line, rgx.block_tic_close)) { + if (line.matchFirst(rgx.block_tic_close)) { type["tic_code"] = 0; } contents ~= line; -} else if (matchFirst(line, rgx.block_tic_code_open)) { +} else if (line.matchFirst(rgx.block_tic_code_open)) { type["tic_code"] = 1; contents ~= line; -} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert = @@ -507,7 +508,7 @@ if (type["curly_code"] == 1) { insert_file_list ~= to!string(fn_src_insert); auto raw = MarkupRawUnit(); /+ TODO +/ - if (auto ma = match(line, rgx.src_fn_text)) { + if (auto ma = line.match(rgx.src_fn_text)) { /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/ writeln(__LINE__); writeln(ma); } diff --git a/org/output.org b/org/output.org index e8ed16e..657b32f 100644 --- a/org/output.org +++ b/org/output.org @@ -171,26 +171,26 @@ auto pth_sisupod = SiSUpodPaths(); mixin SiSUlanguageCodes; auto lang = Lang(); auto rgx = Rgx(); -assert (match(doc_matters.source_filename, rgx.src_fn)); +assert (doc_matters.source_filename.match(rgx.src_fn)); #+END_SRC #+name: source_sisupod_mkdirs #+BEGIN_SRC d /+ create directory structure +/ if (!exists(pth_sisupod.doc(doc_matters.source_filename))) { - mkdirRecurse(pth_sisupod.doc(doc_matters.source_filename)); + pth_sisupod.doc(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_sisupod.conf(doc_matters.source_filename))) { - mkdirRecurse(pth_sisupod.conf(doc_matters.source_filename)); + pth_sisupod.conf(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_sisupod.css(doc_matters.source_filename))) { - mkdirRecurse(pth_sisupod.css(doc_matters.source_filename)); + pth_sisupod.css(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_sisupod.image(doc_matters.source_filename))) { - mkdirRecurse(pth_sisupod.image(doc_matters.source_filename)); + pth_sisupod.image(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language))) { - mkdirRecurse(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language)); + pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language).mkdirRecurse; } #+END_SRC @@ -228,8 +228,7 @@ if (doc_matters.file_insert_list.length > 0) { )); } if (exists(insert_file)) { - copy( - insert_file, + insert_file.copy( pth_sisupod.fn_doc_insert( doc_matters.source_filename, insert_file, @@ -246,8 +245,7 @@ foreach (image; doc_matters.image_list) { ); } if (exists("_sisu/image/"~ image)) { - copy( - ("_sisu/image/"~ image), + ("_sisu/image/"~ image).copy( (pth_sisupod.image(doc_matters.source_filename) ~ "/" ~ image) ); } @@ -442,7 +440,7 @@ auto inline_links(O)( ) { if (obj.inline_links) { if ((seg_scroll == "scroll") - && match(_txt, rgx.mark_internal_site_lnk)) { + && _txt.match(rgx.mark_internal_site_lnk)) { _txt = (_txt).replaceAll( rgx.inline_seg_link, "$1"); @@ -459,7 +457,7 @@ auto inline_links(O)( ); } debug(markup_links) { - if ( match(_txt, rgx.inline_link)) { + if (_txt.match(rgx.inline_link)) { writeln(__LINE__, " (missed) markup link identified (", obj.inline_links, @@ -469,7 +467,7 @@ auto inline_links(O)( } } debug(markup) { - if ( match(_txt, rgx.inline_link)) { + if (_txt.match(rgx.inline_link)) { writeln(__LINE__, " (missed) markup link identified (", obj.inline_links, @@ -497,12 +495,12 @@ auto inline_notes_scroll(O)( ); } debug(markup_endnotes) { - if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text); } } debug(markup) { - if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text); } } @@ -528,7 +526,7 @@ auto inline_notes_seg(O)( string[] _endnotes; if (obj.inline_notes_reg) { /+ need markup for text, and separated footnote +/ - foreach(m; matchAll(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) { _endnotes ~= format( "%s%s%s%s\n %s%s%s%s%s\n %s\n%s", "

", @@ -548,7 +546,7 @@ auto inline_notes_seg(O)( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") ); - } else if (match(_txt, rgx.inline_notes_delimiter_al_regular_number_note)) { + } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { debug(markup) { writeln(__LINE__, " endnote: ", obj.is_a, ": ", obj.text); } @@ -1050,7 +1048,7 @@ void scroll_write_output(Fn,C)( auto pth_html = HtmlPaths(); try { if (!exists(pth_html.base)) { - mkdirRecurse(pth_html.base); + pth_html.base.mkdirRecurse; } auto f = File(pth_html.fn_scroll(fn_src), "w"); foreach (o; doc) { @@ -1291,10 +1289,10 @@ void seg_write_output(M,D,E)( mixin SiSUpaths; auto pth_html = HtmlPaths(); auto xhtml_format = outputXHTMLs(); - auto m = matchFirst(doc_matters.source_filename, rgx.src_fn); + auto m = doc_matters.source_filename.matchFirst(rgx.src_fn); try { if (!exists(pth_html.seg(doc_matters.source_filename))) { - mkdirRecurse(pth_html.seg(doc_matters.source_filename)); + pth_html.seg(doc_matters.source_filename).mkdirRecurse; } foreach (seg_filename; doc_matters.segnames) { auto f = File(pth_html.fn_seg(doc_matters.source_filename, seg_filename), "w"); @@ -2155,7 +2153,7 @@ auto css_write() { auto pth_css_fn= pth_css ~ "/html.css"; try { if (!exists(pth_css)) { - mkdirRecurse(pth_css); + pth_css.mkdirRecurse; } auto f = File(pth_css_fn, "w"); f.writeln(html_css); @@ -2357,7 +2355,6 @@ void outputEPub(D,I)( mixin SiSUoutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); - // string[] toc; string[][string] doc_epub; string[][string] doc_epub_endnotes; string[] doc; @@ -2593,13 +2590,13 @@ void epub_write_output_files(M,D,E,Mt,Mic,Ot,Oc)( auto xhtml_format = outputXHTMLs(); try { if (!exists(pth_epub.doc_meta_inf(doc_matters.source_filename))) { - mkdirRecurse(pth_epub.doc_meta_inf(doc_matters.source_filename)); + pth_epub.doc_meta_inf(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_epub.doc_oebps_css(doc_matters.source_filename))) { - mkdirRecurse(pth_epub.doc_oebps_css(doc_matters.source_filename)); + pth_epub.doc_oebps_css(doc_matters.source_filename).mkdirRecurse; } if (!exists(pth_epub.doc_oebps_image(doc_matters.source_filename))) { - mkdirRecurse(pth_epub.doc_oebps_image(doc_matters.source_filename)); + pth_epub.doc_oebps_image(doc_matters.source_filename).mkdirRecurse; } /+ OEBPS/[segments].xhtml +/ foreach (seg_filename; doc_matters.segnames) { @@ -2627,8 +2624,8 @@ void epub_write_output_files(M,D,E,Mt,Mic,Ot,Oc)( f.writeln(oebps_content_opf); foreach (image; doc_matters.image_list) { if (exists("_sisu/image/"~ image)) { - copy(("_sisu/image/"~ image), - ((pth_epub.doc_oebps_image(doc_matters.source_filename)) ~ "/" ~ image)); + ("_sisu/image/"~ image) + .copy((pth_epub.doc_oebps_image(doc_matters.source_filename)) ~ "/" ~ image); } } } diff --git a/org/sdp.org b/org/sdp.org index ce0aa0d..3332107 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,7 +23,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 13, 5); +enum ver = Version(0, 13, 6); #+END_SRC * 1. sdp (sisu document parser) :sdp: @@ -306,9 +306,9 @@ if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); } foreach(arg; args) { - if (match(arg, rgx.flag_action)) { + if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt - } else if (match(arg, rgx.src_pth)) { + } else if (arg.match(rgx.src_pth)) { fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused arg_unrecognized ~= " " ~ arg; @@ -361,7 +361,7 @@ scope(failure) { } } enforce( - match(fn_src, rgx.src_pth), + fn_src.match(rgx.src_pth), "not a sisu markup filename" ); #+END_SRC @@ -580,7 +580,7 @@ struct DocumentMatters { } auto language() { string _k; - if (auto m = match(fn_src, rgx.language_code_and_filename)) { + if (auto m = fn_src.match(rgx.language_code_and_filename)) { _k = m.captures[1]; } else { _k = "en"; -- cgit v1.2.3