From ac868b590106763c2b3223a1af5cf9f49cce6ca5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 30 Dec 2018 20:55:09 -0500 Subject: cosmetic --- src/doc_reform/doc_reform.d | 10 +++--- src/doc_reform/meta/conf_make_meta_structs.d | 2 +- src/doc_reform/meta/metadoc_from_src.d | 48 ++++++++++++++-------------- src/doc_reform/output/sqlite.d | 8 ++--- src/doc_reform/output/xmls.d | 14 ++++---- 5 files changed, 42 insertions(+), 40 deletions(-) (limited to 'src/doc_reform') diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 081c95c..f1d8d18 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -26,6 +26,7 @@ import std.algorithm; import std.parallelism; mixin(import("version.txt")); mixin CompileTimeInfo; +string program_name = "doc-reform"; /++ name "doc_reform" description "A SiSU inspired document parser writen in D." @@ -44,8 +45,9 @@ void main(string[] args) { scope(success) { debug(checkdoc) { writefln( - "~ run complete, ok ~ (doc_reform-%s.%s.%s, %s D:%s, %s %s)", - ver.major, ver.minor, ver.patch, + "~ run complete, ok ~ (%s-%s.%s.%s, %s D:%s, %s %s)", + program_name, + _ver.major, _ver.minor, _ver.patch, __VENDOR__, __VERSION__, bits, os, ); @@ -395,8 +397,8 @@ void main(string[] args) { } auto _opt_action = OptActions(); auto _env = [ - "pwd" : environment["PWD"], - "home" : environment["HOME"], + "pwd" : environment["PWD"], + "home" : environment["HOME"], ]; auto _manifest_start = PodManifest!()(""); auto _manifest_matter = PathMatters!()(_opt_action, _env, ""); diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 2fec217..e7b9a5b 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -17,7 +17,7 @@ static auto _rgx = Rgx(); mixin InternalMarkup; auto _mkup = InlineMarkup(); auto url_markup(string line) { - auto line_ = (line) + auto line_ = line .replaceAll( _rgx.smid_inline_link_markup_regular, ("$1" diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index c3c6147..66efc04 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -422,7 +422,7 @@ template DocReformDocAbstraction() { line, ); } - line = (line).replaceAll(rgx.true_dollar, "$$$$"); + line = line.replaceAll(rgx.true_dollar, "$$$$"); /+ dollar represented as $$ needed to stop submatching on $ (substitutions using ${identifiers} must take into account (i.e. happen earlier)) +/ @@ -704,7 +704,7 @@ template DocReformDocAbstraction() { /+ within block object: group +/ line = _doc_header_and_make_substitutions_(line, conf_make_meta); line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); - line = (line) + line = line .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); _group_block_(line, an_object, obj_type_status); continue; @@ -713,11 +713,11 @@ template DocReformDocAbstraction() { line = _doc_header_and_make_substitutions_(line, conf_make_meta); line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta); if (auto m = line.match(rgx.spaces_line_start)) { - line = (line) + line = line .replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } if (auto m = line.match(rgx.spaces_multiple)) { - line = (line) + line = line .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } _block_block_(line, an_object, obj_type_status); @@ -3180,7 +3180,7 @@ template DocReformDocAbstraction() { tmp ~= au.str; } } - tmp = (tmp).replace(rgx.trailing_comma, ""); + tmp = tmp.replace(rgx.trailing_comma, ""); j["author"].str = tmp; goto default; case "editor_raw": // editor_arr editor (fn sn) @@ -3195,7 +3195,7 @@ template DocReformDocAbstraction() { tmp ~= ed.str; } } - tmp = (tmp).replace(rgx.trailing_comma, ""); + tmp = tmp.replace(rgx.trailing_comma, ""); j["editor"].str = tmp; goto default; case "fulltitle": // title & subtitle @@ -3996,7 +3996,7 @@ template DocReformDocAbstraction() { ) { static auto rgx = Rgx(); if (textline.match(rgx.inline_faces_line)) { - textline = (textline) + textline = textline .replaceFirst(rgx.inline_emphasis_line, ("*{$1}*$2")) .replaceFirst(rgx.inline_bold_line, ("!{$1}!$2")) .replaceFirst(rgx.inline_underscore_line, ("_{$1}_$2")) @@ -4280,7 +4280,7 @@ template DocReformDocAbstraction() { if (obj_txt_in.match(rgx.smid_inline_url_generic)) { /+ link: naked url: http://url +/ if (obj_txt_in.match(rgx.smid_inline_link_naked_url)) { - obj_txt_in = (obj_txt_in).replaceAll( + obj_txt_in = obj_txt_in.replaceAll( rgx.smid_inline_link_naked_url, ("$1" ~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c @@ -4294,7 +4294,7 @@ template DocReformDocAbstraction() { { link which includes url as footnote }http://url~{ { http://url }http://url }~ +/ if (obj_txt_in.match(rgx.smid_inline_link_endnote_url_helper)) { - obj_txt_in = (obj_txt_in) + obj_txt_in = obj_txt_in .replaceAll( rgx.smid_inline_link_endnote_url_helper_punctuated, (mkup.lnk_o ~ "$1" ~ mkup.lnk_c @@ -4316,7 +4316,7 @@ template DocReformDocAbstraction() { { linked text or image }http://url +/ if (obj_txt_in.match(rgx.smid_inline_link_markup_regular)) { - obj_txt_in = (obj_txt_in).replaceAll( + obj_txt_in = obj_txt_in.replaceAll( rgx.smid_inline_link_markup_regular, ("$1" ~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c @@ -4341,7 +4341,7 @@ template DocReformDocAbstraction() { writeln("Image: ", obj_txt_in); } if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { - obj_txt_in = (obj_txt_in).replaceAll( + obj_txt_in = obj_txt_in.replaceAll( rgx.smid_image_with_dimensions, ("$1" ~ mkup.img ~ "$2,w$3h$4 " @@ -4351,7 +4351,7 @@ template DocReformDocAbstraction() { writeln("IMAGE with size: ", obj_txt_in); // decide on representation } } else if (obj_txt_in.match(rgx.smid_image)) { - obj_txt_in = (obj_txt_in).replaceAll( + obj_txt_in = obj_txt_in.replaceAll( rgx.smid_image, ("$1" ~ mkup.img ~ "$2,w0h0 " @@ -4373,7 +4373,7 @@ template DocReformDocAbstraction() { bool flg_notes_reg = false; bool flg_notes_star = false; bool flg_notes_plus = false; - obj_txt_in = (obj_txt_in).replaceAll( + obj_txt_in = obj_txt_in.replaceAll( rgx.inline_notes_curly, (mkup.en_a_o ~ " $1" ~ mkup.en_a_c) ); @@ -4466,7 +4466,7 @@ template DocReformDocAbstraction() { obj_txt_in = url_links(obj_txt_in); } if (auto m = obj_txt_in.match(rgx.para_inline_link_anchor)) { - obj_txt_in = (obj_txt_in) + obj_txt_in = obj_txt_in .replaceAll(rgx.para_inline_link_anchor, "┋$1┋"); } auto ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); @@ -4507,7 +4507,7 @@ template DocReformDocAbstraction() { } } body { - obj_txt["munge"]=(obj_txt_in) + obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") .strip; @@ -4595,7 +4595,7 @@ template DocReformDocAbstraction() { } } body { - obj_txt_in = (obj_txt_in).replaceAll(rgx.space, mkup.nbsp); + obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; } @@ -4948,7 +4948,7 @@ template DocReformDocAbstraction() { } if ((!empty(heading_number_auto_composite)) && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) { - munge_=(munge_) + munge_ = munge_ .replaceFirst(rgx.heading, "$1~$2 " ~ heading_number_auto_composite ~ ". ") .replaceFirst(rgx.heading_marker_missing_tag, @@ -4970,16 +4970,16 @@ template DocReformDocAbstraction() { 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( + munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { auto tag_remunge_ = n.captures[2] .replaceAll(rgx.heading_marker_tag_has_colon, ".."); - munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); + munge_=munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); } } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { - munge_=(munge_).replaceFirst( + munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ "s" ~ m.captures[1] ~ " "); } @@ -4988,7 +4988,7 @@ template DocReformDocAbstraction() { heading_num_lev1 = 0; } heading_num_lev1 ++; - munge_=(munge_).replaceFirst( + munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, "$1~" ~ "x" ~ heading_num_lev1.to!string ~ " "); } @@ -5423,7 +5423,7 @@ template DocReformDocAbstraction() { foreach (mainkey; mainkeys) { write("_0_1 !{", mainkey, "}! "); foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { - auto go = (ref_).replaceAll(rgx.book_index_go, "$1"); + auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); } writeln(" \\\\"); @@ -5433,7 +5433,7 @@ template DocReformDocAbstraction() { foreach (subkey; subkeys) { write(" ", subkey, ", "); foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { - auto go = (ref_).replaceAll(rgx.book_index_go, "$1"); + auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); } writeln(" \\\\"); @@ -5551,7 +5551,7 @@ template DocReformDocAbstraction() { bi_tmp ~= " \\\\\n "; ++skn; } - bi_tmp = (bi_tmp).replaceFirst(rgx.trailing_linebreak, ""); + bi_tmp = bi_tmp.replaceFirst(rgx.trailing_linebreak, ""); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "backmatter"; comp_obj_para.metainfo.is_of_section = "bookindex"; diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index d09b9b8..bf0d546 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -286,7 +286,7 @@ template SQLiteFormatAndLoadObject() { if (obj.has.inline_links) { if ((_txt.match(rgx.mark_internal_site_lnk)) && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_seg_link, "$1"); } @@ -340,7 +340,7 @@ template SQLiteFormatAndLoadObject() { ); } } - _txt = (_txt) + _txt = _txt .replaceAll( rgx.inline_link_fn_suffix, ("$1.html")) @@ -380,7 +380,7 @@ template SQLiteFormatAndLoadObject() { ) { if (obj.has.inline_notes_reg) { // _txt = font_face(_txt); - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") ); @@ -421,7 +421,7 @@ template SQLiteFormatAndLoadObject() { "

" ); } - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") ); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 6a999f6..ef35e10 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -48,7 +48,7 @@ template outputXHTMLs() { const O obj, string _txt ){ - _txt = (_txt) + _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) .replaceAll(rgx.xhtml_less_than, "<") @@ -61,7 +61,7 @@ template outputXHTMLs() { return _txt; } string special_characters_text(string _txt){ - _txt = (_txt) + _txt = _txt .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_quotation, """) .replaceAll(rgx.xhtml_less_than, "<") @@ -70,7 +70,7 @@ template outputXHTMLs() { return _txt; } string font_face(string _txt){ - _txt = (_txt) + _txt = _txt .replaceAll(rgx.inline_emphasis, ("$1")) .replaceAll(rgx.inline_bold, ("$1")) .replaceAll(rgx.inline_underscore, ("$1")) @@ -360,7 +360,7 @@ template outputXHTMLs() { if (obj.has.inline_links) { if ((_txt.match(rgx.mark_internal_site_lnk)) && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_seg_link, "$1"); } @@ -399,7 +399,7 @@ template outputXHTMLs() { } } } - _txt = (_txt) + _txt = _txt .replaceAll( rgx.inline_link_fn_suffix, ("$1" ~ _suffix)) @@ -439,7 +439,7 @@ template outputXHTMLs() { ) { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") ); @@ -481,7 +481,7 @@ template outputXHTMLs() { "

" ); } - _txt = (_txt).replaceAll( + _txt = _txt.replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, (" $1 ") ); -- cgit v1.2.3