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 --- src/sdp/abstraction.d | 2 +- src/sdp/ao_abstract_doc_source.d | 576 ++++++++++++++++++------------------- src/sdp/ao_conf_make_meta.d | 2 +- src/sdp/ao_conf_make_meta_native.d | 46 ++- src/sdp/ao_conf_make_meta_sdlang.d | 6 +- src/sdp/ao_doc_debugs.d | 20 +- src/sdp/ao_read_config_files.d | 2 +- src/sdp/ao_read_source_files.d | 47 +-- src/sdp/output_epub.d | 11 +- src/sdp/output_html.d | 8 +- src/sdp/output_xhtmls.d | 14 +- src/sdp/source_sisupod.d | 18 +- 12 files changed, 370 insertions(+), 382 deletions(-) (limited to 'src/sdp') diff --git a/src/sdp/abstraction.d b/src/sdp/abstraction.d index 77a5512..65bb5cd 100644 --- a/src/sdp/abstraction.d +++ b/src/sdp/abstraction.d @@ -100,7 +100,7 @@ template SiSUabstraction() { } 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"; diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 82341cd..a277a61 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -92,47 +92,47 @@ template SiSUdocAbstraction() { ) { 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; @@ -387,11 +387,11 @@ template SiSUdocAbstraction() { /+ object other than "code block" object (includes regular text paragraph, headings & blocks other than code) +/ /+ heading, glossary, blurb, poem, group, block, quote, table +/ - 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; @@ -404,11 +404,11 @@ template SiSUdocAbstraction() { } } continue; - } 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__); @@ -427,7 +427,7 @@ template SiSUdocAbstraction() { 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"; @@ -462,7 +462,7 @@ template SiSUdocAbstraction() { 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"]; @@ -473,11 +473,11 @@ template SiSUdocAbstraction() { type["ocn_status"] = TriState.off; } continue; - } 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__); @@ -495,7 +495,7 @@ template SiSUdocAbstraction() { 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"; @@ -524,19 +524,19 @@ template SiSUdocAbstraction() { 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_; @@ -546,7 +546,7 @@ template SiSUdocAbstraction() { 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"]; @@ -586,12 +586,12 @@ template SiSUdocAbstraction() { "block status: none or closed" ); assertions_flag_types_block_status_none_or_closed(type); - if (matchFirst(line, rgx.block_open)) { - if (matchFirst(line, (rgx.block_poem_open))) { + if (line.matchFirst(rgx.block_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; @@ -614,14 +614,14 @@ template SiSUdocAbstraction() { 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 ); } - 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); } else { @@ -667,7 +667,7 @@ template SiSUdocAbstraction() { - 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) { @@ -719,7 +719,7 @@ template SiSUdocAbstraction() { 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"; @@ -728,14 +728,14 @@ template SiSUdocAbstraction() { 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 = ""; } @@ -816,9 +816,9 @@ template SiSUdocAbstraction() { 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; @@ -857,12 +857,11 @@ template SiSUdocAbstraction() { 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, @@ -979,7 +978,7 @@ template SiSUdocAbstraction() { 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; @@ -1052,7 +1051,7 @@ template SiSUdocAbstraction() { ".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; } @@ -1065,7 +1064,7 @@ template SiSUdocAbstraction() { ".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( @@ -1074,7 +1073,7 @@ template SiSUdocAbstraction() { "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; } @@ -1087,7 +1086,7 @@ template SiSUdocAbstraction() { ".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; @@ -1097,7 +1096,7 @@ template SiSUdocAbstraction() { "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; } @@ -1110,7 +1109,7 @@ template SiSUdocAbstraction() { ".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; } @@ -1121,7 +1120,7 @@ template SiSUdocAbstraction() { "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; } @@ -1134,7 +1133,7 @@ template SiSUdocAbstraction() { ".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( @@ -1144,7 +1143,7 @@ template SiSUdocAbstraction() { ); 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) { @@ -1233,7 +1232,7 @@ template SiSUdocAbstraction() { 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_; @@ -1640,15 +1639,15 @@ template SiSUdocAbstraction() { 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); @@ -1656,9 +1655,9 @@ template SiSUdocAbstraction() { } } 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; @@ -1669,7 +1668,7 @@ template SiSUdocAbstraction() { } } } 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) { @@ -1689,7 +1688,7 @@ template SiSUdocAbstraction() { static assert(is(typeof(obj_cite_number_poem) == string[string])); } 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( @@ -1700,7 +1699,7 @@ template SiSUdocAbstraction() { 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( @@ -1709,12 +1708,12 @@ template SiSUdocAbstraction() { ); } 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( @@ -1725,7 +1724,7 @@ template SiSUdocAbstraction() { 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( @@ -1736,7 +1735,7 @@ template SiSUdocAbstraction() { 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( @@ -1747,7 +1746,7 @@ template SiSUdocAbstraction() { 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( @@ -1758,7 +1757,7 @@ template SiSUdocAbstraction() { type["blocks"] = TriState.on; type["table"] = TriState.on; type["curly_table"] = TriState.on; - } 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( @@ -1769,7 +1768,7 @@ template SiSUdocAbstraction() { 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( @@ -1777,12 +1776,12 @@ template SiSUdocAbstraction() { 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( @@ -1793,7 +1792,7 @@ template SiSUdocAbstraction() { 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( @@ -1804,7 +1803,7 @@ template SiSUdocAbstraction() { 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( @@ -1815,7 +1814,7 @@ template SiSUdocAbstraction() { 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( @@ -1840,7 +1839,7 @@ template SiSUdocAbstraction() { } 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); } @@ -1854,7 +1853,7 @@ template SiSUdocAbstraction() { 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); } @@ -1901,7 +1900,7 @@ template SiSUdocAbstraction() { 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; @@ -1936,16 +1935,16 @@ template SiSUdocAbstraction() { 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; @@ -1956,11 +1955,11 @@ template SiSUdocAbstraction() { 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; @@ -1971,11 +1970,11 @@ template SiSUdocAbstraction() { 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; @@ -1998,7 +1997,7 @@ template SiSUdocAbstraction() { j[biblio_tag_name] ); } - if ((match(line, rgx.comment))) { + if (line.match(rgx.comment)) { writeln("ERROR", line, "COMMENT"); writeln("ERROR", s, "%%"); } @@ -2026,7 +2025,7 @@ template SiSUdocAbstraction() { } 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); } @@ -2040,7 +2039,7 @@ template SiSUdocAbstraction() { 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); } @@ -2067,7 +2066,7 @@ template SiSUdocAbstraction() { } 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); } @@ -2081,7 +2080,7 @@ template SiSUdocAbstraction() { 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); } @@ -2114,7 +2113,7 @@ template SiSUdocAbstraction() { } 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( @@ -2150,7 +2149,7 @@ template SiSUdocAbstraction() { 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]; @@ -2161,7 +2160,7 @@ template SiSUdocAbstraction() { ++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; @@ -2171,7 +2170,7 @@ template SiSUdocAbstraction() { 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; } @@ -2204,7 +2203,7 @@ template SiSUdocAbstraction() { 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]; @@ -2216,7 +2215,7 @@ template SiSUdocAbstraction() { } } } 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( @@ -2243,13 +2242,13 @@ template SiSUdocAbstraction() { 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; @@ -2263,7 +2262,7 @@ template SiSUdocAbstraction() { 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; } @@ -2297,7 +2296,7 @@ template SiSUdocAbstraction() { 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]; @@ -2322,7 +2321,7 @@ template SiSUdocAbstraction() { } 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); } @@ -2336,7 +2335,7 @@ template SiSUdocAbstraction() { 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); } @@ -2363,7 +2362,7 @@ template SiSUdocAbstraction() { } 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); } @@ -2377,7 +2376,7 @@ template SiSUdocAbstraction() { 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); } @@ -2445,7 +2444,7 @@ template SiSUdocAbstraction() { 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]; @@ -2485,7 +2484,7 @@ template SiSUdocAbstraction() { 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]; @@ -2526,7 +2525,7 @@ template SiSUdocAbstraction() { 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]; @@ -2598,7 +2597,7 @@ template SiSUdocAbstraction() { 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]; @@ -2639,7 +2638,7 @@ template SiSUdocAbstraction() { 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]; @@ -2667,20 +2666,20 @@ template SiSUdocAbstraction() { 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", @@ -2690,11 +2689,11 @@ template SiSUdocAbstraction() { } } 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", @@ -2733,9 +2732,8 @@ template SiSUdocAbstraction() { 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); @@ -2744,7 +2742,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2752,7 +2750,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2760,7 +2758,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2768,7 +2766,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2776,7 +2774,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2784,7 +2782,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2792,7 +2790,7 @@ template SiSUdocAbstraction() { 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"]); } @@ -2821,43 +2819,43 @@ template SiSUdocAbstraction() { && ((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); @@ -2886,10 +2884,10 @@ template SiSUdocAbstraction() { 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; @@ -2908,7 +2906,7 @@ template SiSUdocAbstraction() { 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; @@ -2922,7 +2920,7 @@ template SiSUdocAbstraction() { 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; @@ -2935,7 +2933,7 @@ template SiSUdocAbstraction() { 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; @@ -2947,7 +2945,7 @@ template SiSUdocAbstraction() { 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; @@ -2966,7 +2964,7 @@ template SiSUdocAbstraction() { 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; @@ -2976,11 +2974,11 @@ template SiSUdocAbstraction() { 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"]; @@ -2990,11 +2988,11 @@ template SiSUdocAbstraction() { 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"]; @@ -3003,20 +3001,20 @@ template SiSUdocAbstraction() { 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); } } } @@ -3049,31 +3047,31 @@ template SiSUdocAbstraction() { "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; @@ -3085,7 +3083,7 @@ template SiSUdocAbstraction() { 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")) @@ -3134,9 +3132,9 @@ template SiSUdocAbstraction() { 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" @@ -3150,7 +3148,7 @@ template SiSUdocAbstraction() { 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 @@ -3171,7 +3169,7 @@ template SiSUdocAbstraction() { /+ 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" @@ -3197,8 +3195,8 @@ template SiSUdocAbstraction() { 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; @@ -3207,25 +3205,25 @@ template SiSUdocAbstraction() { } 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"; } } } @@ -3250,19 +3248,16 @@ template SiSUdocAbstraction() { 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); } @@ -3280,7 +3275,7 @@ template SiSUdocAbstraction() { } } auto t = tuple( - to!string(obj_txt_out), + obj_txt_out, ftn[1], ftn[2], urls, @@ -3311,7 +3306,7 @@ template SiSUdocAbstraction() { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); - writeln(to!string(obj_txt["munge"])); + writeln(obj_txt["munge"].to!string); } return t; } @@ -3332,7 +3327,7 @@ template SiSUdocAbstraction() { writeln(__LINE__); writeln(obj_txt_in); writeln(__LINE__); - writeln(to!string(obj_txt["munge"])); + writeln(obj_txt["munge"].to!string); } return t; } @@ -3439,7 +3434,7 @@ template SiSUdocAbstraction() { } 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_ = []; @@ -3454,7 +3449,7 @@ template SiSUdocAbstraction() { // 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") { @@ -3516,7 +3511,7 @@ template SiSUdocAbstraction() { 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, ""); @@ -3549,10 +3544,10 @@ template SiSUdocAbstraction() { 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", @@ -3569,7 +3564,7 @@ template SiSUdocAbstraction() { 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 { @@ -3598,7 +3593,7 @@ template SiSUdocAbstraction() { 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, @@ -3608,14 +3603,14 @@ template SiSUdocAbstraction() { 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", @@ -3624,7 +3619,7 @@ template SiSUdocAbstraction() { 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; @@ -3639,12 +3634,12 @@ template SiSUdocAbstraction() { 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; @@ -3663,15 +3658,15 @@ template SiSUdocAbstraction() { _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; @@ -3703,7 +3698,7 @@ template SiSUdocAbstraction() { 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": @@ -3736,7 +3731,7 @@ template SiSUdocAbstraction() { /+ 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; @@ -3744,7 +3739,7 @@ template SiSUdocAbstraction() { 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; @@ -3752,54 +3747,54 @@ template SiSUdocAbstraction() { 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 = ""; @@ -3807,7 +3802,7 @@ template SiSUdocAbstraction() { 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, @@ -3825,13 +3820,13 @@ template SiSUdocAbstraction() { 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] ~ " "); @@ -3841,7 +3836,7 @@ template SiSUdocAbstraction() { 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_; @@ -3972,22 +3967,22 @@ template SiSUdocAbstraction() { } } 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," @@ -4172,7 +4167,7 @@ template SiSUdocAbstraction() { 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 ); } } @@ -4181,41 +4176,39 @@ template SiSUdocAbstraction() { 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; } @@ -4371,7 +4364,7 @@ template SiSUdocAbstraction() { 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" @@ -4383,7 +4376,7 @@ template SiSUdocAbstraction() { } 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 @@ -4421,7 +4414,7 @@ template SiSUdocAbstraction() { 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; @@ -4430,7 +4423,7 @@ template SiSUdocAbstraction() { 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; @@ -4470,7 +4463,7 @@ template SiSUdocAbstraction() { 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) ); } @@ -4480,8 +4473,7 @@ template SiSUdocAbstraction() { auto munge = ObjInlineMarkupMunge(); foreach( m; - matchAll( - contents_am[cntr].text, + (contents_am[cntr].text).matchAll( rgx.inline_notes_delimiter_al_regular_number_note ) ) { @@ -4518,8 +4510,8 @@ template SiSUdocAbstraction() { 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"] = []; @@ -4602,8 +4594,8 @@ template SiSUdocAbstraction() { 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; @@ -4738,12 +4730,12 @@ template SiSUdocAbstraction() { 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; @@ -4761,14 +4753,14 @@ template SiSUdocAbstraction() { 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); @@ -4811,18 +4803,18 @@ template SiSUdocAbstraction() { 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; @@ -4907,13 +4899,13 @@ template SiSUdocAbstraction() { _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; @@ -4924,18 +4916,18 @@ template SiSUdocAbstraction() { _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) { @@ -5054,7 +5046,7 @@ template SiSUdocAbstraction() { } 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/src/sdp/ao_conf_make_meta.d b/src/sdp/ao_conf_make_meta.d index 40c68ea..b34b7f3 100644 --- a/src/sdp/ao_conf_make_meta.d +++ b/src/sdp/ao_conf_make_meta.d @@ -36,7 +36,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)); diff --git a/src/sdp/ao_conf_make_meta_native.d b/src/sdp/ao_conf_make_meta_native.d index 08a7d9f..500be52 100644 --- a/src/sdp/ao_conf_make_meta_native.d +++ b/src/sdp/ao_conf_make_meta_native.d @@ -40,15 +40,13 @@ template SiSUheaderExtractNative() { 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"] = @@ -68,7 +66,7 @@ template SiSUheaderExtractNative() { && (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]); } @@ -84,7 +82,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -96,7 +94,7 @@ template SiSUheaderExtractNative() { } 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"] = @@ -112,7 +110,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -124,7 +122,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -136,7 +134,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -148,7 +146,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -160,7 +158,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -172,7 +170,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -184,7 +182,7 @@ template SiSUheaderExtractNative() { } 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]); @@ -226,14 +224,14 @@ template SiSUheaderExtractNative() { 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; @@ -243,14 +241,14 @@ template SiSUheaderExtractNative() { 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"; @@ -291,14 +289,14 @@ template SiSUheaderExtractNative() { 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/src/sdp/ao_conf_make_meta_sdlang.d b/src/sdp/ao_conf_make_meta_sdlang.d index 04261d0..533f482 100644 --- a/src/sdp/ao_conf_make_meta_sdlang.d +++ b/src/sdp/ao_conf_make_meta_sdlang.d @@ -216,7 +216,7 @@ template SiSUheaderExtractSDLang() { 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) { @@ -263,9 +263,9 @@ template SiSUheaderExtractSDLang() { } 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); diff --git a/src/sdp/ao_doc_debugs.d b/src/sdp/ao_doc_debugs.d index 2c0da82..989a826 100644 --- a/src/sdp/ao_doc_debugs.d +++ b/src/sdp/ao_doc_debugs.d @@ -249,7 +249,7 @@ template SiSUdebugs() { 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, @@ -275,7 +275,7 @@ template SiSUdebugs() { 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, @@ -287,7 +287,7 @@ template SiSUdebugs() { 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, @@ -299,7 +299,7 @@ template SiSUdebugs() { 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, @@ -311,7 +311,7 @@ template SiSUdebugs() { 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, @@ -323,7 +323,7 @@ template SiSUdebugs() { 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, @@ -335,7 +335,7 @@ template SiSUdebugs() { 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, @@ -347,7 +347,7 @@ template SiSUdebugs() { 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, @@ -359,7 +359,7 @@ template SiSUdebugs() { 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, @@ -371,7 +371,7 @@ template SiSUdebugs() { 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/src/sdp/ao_read_config_files.d b/src/sdp/ao_read_config_files.d index 51fd81b..2cdf861 100644 --- a/src/sdp/ao_read_config_files.d +++ b/src/sdp/ao_read_config_files.d @@ -43,7 +43,7 @@ template ConfigIn() { debug(configfile) { writeln(conf_file); } - config_file_str = readText(conf_file); + config_file_str = conf_file.readText; break; } } diff --git a/src/sdp/ao_read_source_files.d b/src/sdp/ao_read_source_files.d index 4acfe41..b47918a 100644 --- a/src/sdp/ao_read_source_files.d +++ b/src/sdp/ao_read_source_files.d @@ -44,7 +44,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); @@ -71,7 +71,7 @@ template SiSUrawMarkupContent() { string source_txt_str; try { if (exists(fn_src)) { - source_txt_str = readText(fn_src); + source_txt_str = fn_src.readText; } } catch (ErrnoException ex) { @@ -88,24 +88,25 @@ template SiSUrawMarkupContent() { 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; } 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; } 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); @@ -129,7 +130,7 @@ template SiSUrawMarkupContent() { 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); @@ -146,17 +147,17 @@ template SiSUrawMarkupContent() { mixin SiSUrgxInitFlags; 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]; foreach (line; markup_sourcefile_insert_content) { 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; @@ -164,28 +165,28 @@ template SiSUrawMarkupContent() { } 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]; @@ -229,27 +230,27 @@ template SiSUrawMarkupContent() { mixin SiSUrgxInitFlags; 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 =[]; foreach (line; sourcefile_body_content) { 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 = @@ -257,7 +258,7 @@ template SiSUrawMarkupContent() { 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/src/sdp/output_epub.d b/src/sdp/output_epub.d index c66bf8f..3724854 100644 --- a/src/sdp/output_epub.d +++ b/src/sdp/output_epub.d @@ -165,7 +165,6 @@ template outputEPub() { mixin SiSUoutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); - // string[] toc; string[][string] doc_epub; string[][string] doc_epub_endnotes; string[] doc; @@ -395,13 +394,13 @@ template outputEPub() { 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) { @@ -429,8 +428,8 @@ template outputEPub() { 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/src/sdp/output_html.d b/src/sdp/output_html.d index cc330b2..6d4e0c5 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -177,7 +177,7 @@ template outputHTML() { 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) { @@ -405,10 +405,10 @@ template outputHTML() { 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"); @@ -1263,7 +1263,7 @@ template outputHTML() { 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); diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d index dcbc8f8..4ee5a79 100644 --- a/src/sdp/output_xhtmls.d +++ b/src/sdp/output_xhtmls.d @@ -153,7 +153,7 @@ template outputXHTMLs() { ) { 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"); @@ -170,7 +170,7 @@ template outputXHTMLs() { ); } debug(markup_links) { - if ( match(_txt, rgx.inline_link)) { + if (_txt.match(rgx.inline_link)) { writeln(__LINE__, " (missed) markup link identified (", obj.inline_links, @@ -180,7 +180,7 @@ template outputXHTMLs() { } } debug(markup) { - if ( match(_txt, rgx.inline_link)) { + if (_txt.match(rgx.inline_link)) { writeln(__LINE__, " (missed) markup link identified (", obj.inline_links, @@ -202,12 +202,12 @@ template outputXHTMLs() { ); } 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); } } @@ -227,7 +227,7 @@ template outputXHTMLs() { 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", "

", @@ -247,7 +247,7 @@ template outputXHTMLs() { 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); } diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d index ce2bfaf..e6702bf 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/source_sisupod.d @@ -32,23 +32,23 @@ template SiSUpod() { 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)); try { /+ 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; } debug(sisupod) { writeln(__LINE__, ": ", @@ -80,8 +80,7 @@ template SiSUpod() { )); } if (exists(insert_file)) { - copy( - insert_file, + insert_file.copy( pth_sisupod.fn_doc_insert( doc_matters.source_filename, insert_file, @@ -98,8 +97,7 @@ template SiSUpod() { ); } if (exists("_sisu/image/"~ image)) { - copy( - ("_sisu/image/"~ image), + ("_sisu/image/"~ image).copy( (pth_sisupod.image(doc_matters.source_filename) ~ "/" ~ image) ); } -- cgit v1.2.3