From ed17763e72b7a9508432e341cb4aca1b2186d329 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 18 Dec 2019 10:55:24 -0500 Subject: cosmetic primarily "format" --- src/doc_reform/meta/metadoc.d | 3 +- src/doc_reform/meta/metadoc_from_src.d | 72 +++++++++++++++++++++++----------- src/doc_reform/meta/rgx.d | 2 +- 3 files changed, 52 insertions(+), 25 deletions(-) (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 0db5d96..03cb098 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -120,8 +120,7 @@ template spineAbstraction() { return program_info.ver; } string name_and_version() @trusted { - return format( - "%s-%s", + return format("%s-%s", name, ver, ); diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 99de32c..9178fae 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -1294,8 +1294,7 @@ template docAbstraction() { } string out_; foreach (entry; biblio_ordered) { - out_ = format( - "%s \"%s\"%s%s%s%s%s%s%s%s%s.", + out_ = format("%s \"%s\"%s%s%s%s%s%s%s%s%s.", ((entry["author"].str.empty) ? entry["editor"].str : entry["author"].str), entry["fulltitle"].str, ((entry["journal"].str.empty) ? "" : ", " ~ mkup.italic ~ mkup.ff_o ~ entry["journal"].str ~ mkup.ff_c ~ mkup.italic), @@ -1386,10 +1385,13 @@ template docAbstraction() { comp_obj_toc.attrib.indent_base = indent["base_position"]; comp_obj_toc.attrib.bullet = false; if (the_endnotes_section.length > 1) { - toc_txt_ = format( - mkup.lnk_o ~ "%s" ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, + toc_txt_ = format("%s%s%s%s%s#%s", + mkup.lnk_o, "Endnotes", + mkup.lnk_c, + mkup.url_o, "endnotes", + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; @@ -1397,10 +1399,13 @@ template docAbstraction() { the_table_of_contents_section ~= comp_obj_toc; } if (the_glossary_section.length > 1) { - toc_txt_ = format( - mkup.lnk_o ~ "%s" ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, "Glossary", + mkup.lnk_c, + mkup.url_o, "glossary", + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; @@ -1408,10 +1413,13 @@ template docAbstraction() { the_table_of_contents_section ~= comp_obj_toc; } if (the_bibliography_section.length > 1){ - toc_txt_ = format( - mkup.lnk_o ~ "%s" ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, "Bibliography", + mkup.lnk_c, + mkup.url_o, "bibliography", + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; @@ -1419,10 +1427,13 @@ template docAbstraction() { the_table_of_contents_section ~= comp_obj_toc; } if (the_bookindex_section.length > 1) { - toc_txt_ = format( - mkup.lnk_o ~ "%s" ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, "Book Index", + mkup.lnk_c, + mkup.url_o, "bookindex", + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; @@ -1430,10 +1441,13 @@ template docAbstraction() { the_table_of_contents_section ~= comp_obj_toc; } if (the_blurb_section.length > 1) { - toc_txt_ = format( - mkup.lnk_o ~ "%s" ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, "Blurb", + mkup.lnk_c, + mkup.url_o, "blurb", + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc.has.inline_links = true; @@ -4042,10 +4056,18 @@ template docAbstraction() { static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { textline = textline - .replaceFirst(rgx.inline_emphasis_line, format(q"┃%s%s%s%s%s%s┃", mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) - .replaceFirst(rgx.inline_bold_line, format(q"┃%s%s%s%s%s%s┃", mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) - .replaceFirst(rgx.inline_underscore_line, format(q"┃%s%s%s%s%s%s┃", mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) - .replaceFirst(rgx.inline_italics_line, format(q"┃%s%s%s%s%s%s┃", mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); + .replaceFirst(rgx.inline_emphasis_line, + format(q"┃%s%s%s%s%s%s┃", + mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) + .replaceFirst(rgx.inline_bold_line, + format(q"┃%s%s%s%s%s%s┃", + mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) + .replaceFirst(rgx.inline_underscore_line, + format(q"┃%s%s%s%s%s%s┃", + mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) + .replaceFirst(rgx.inline_italics_line, + format(q"┃%s%s%s%s%s%s┃", + mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); } return textline; } @@ -4659,10 +4681,13 @@ template docAbstraction() { "hang_position" : obj_["lev_markup_number"].to!int, "base_position" : obj_["lev_markup_number"].to!int, ]; - toc_txt_ = format( - mkup.lnk_o ~ "%s".strip ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, - heading_toc_, + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + heading_toc_.strip, + mkup.lnk_c, + mkup.url_o, _anchor_tag, + mkup.url_c, ); toc_txt_= toc_txt_.links_and_images; comp_obj_toc = comp_obj_toc.init; @@ -4701,10 +4726,13 @@ template docAbstraction() { lev4_subtoc[tag_in_seg["seg_lv4"]] = []; break; case 5: .. case 7: - subtoc_txt_ = format( - mkup.lnk_o ~ "%s".strip ~ mkup.lnk_c ~ mkup.url_o ~ "#%s"~ mkup.url_c, - heading_toc_, + subtoc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + heading_toc_.strip, + mkup.lnk_c, + mkup.url_o, _anchor_tag, + mkup.url_c, ); lev4_subtoc[tag_in_seg["seg_lv4"]] ~= links_and_images(obj_["lev_markup_number"] diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index d08100b..b6d23bf 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -44,7 +44,7 @@ static template spineRgxInit() { static variable_doc_title = ctRegex!(`@title`); static variable_doc_author = ctRegex!(`@author|@creator`); static raw_author_munge = ctRegex!(`(?P\S.+?),\s+(?P.+)`,"i"); - static yaml_header_meta_title = ctRegex!(`^\s*(?:title\s*:\s*(?:"?\w|$))`, "m"); + static yaml_header_meta_title = ctRegex!(`^\s*title\s*:\s*(?:"?\w|$)`, "m"); static yaml_config = ctRegex!(`^[a-z]+\s*:\s*(?:"?\w|$)`, "m"); /+ heading & paragraph operators +/ static heading_a = ctRegex!(`^:?[A][~] `, "m"); -- cgit v1.2.3