aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-12-18 10:55:24 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2020-02-08 19:49:11 -0500
commited17763e72b7a9508432e341cb4aca1b2186d329 (patch)
treea2f98dcd0dbc309a840d6575a49518bf5cc9b5a5
parentdmd releaseMode results in runtime errors (diff)
cosmetic primarily "format"
-rw-r--r--org/default_regex.org2
-rw-r--r--org/metaverse.org72
-rw-r--r--org/spine.org11
-rw-r--r--src/doc_reform/meta/metadoc.d3
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d72
-rw-r--r--src/doc_reform/meta/rgx.d2
-rwxr-xr-xsrc/doc_reform/spine.d8
7 files changed, 108 insertions, 62 deletions
diff --git a/org/default_regex.org b/org/default_regex.org
index bdd7863..3dd9cd1 100644
--- a/org/default_regex.org
+++ b/org/default_regex.org
@@ -108,7 +108,7 @@ static comment = ctRegex!(`^%+ `);
static variable_doc_title = ctRegex!(`@title`);
static variable_doc_author = ctRegex!(`@author|@creator`);
static raw_author_munge = ctRegex!(`(?P<last>\S.+?),\s+(?P<first>.+)`,"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");
#+END_SRC
diff --git a/org/metaverse.org b/org/metaverse.org
index c7f3481..77a9051 100644
--- a/org/metaverse.org
+++ b/org/metaverse.org
@@ -1680,8 +1680,7 @@ if (biblio_ordered.length > 0) {
#+BEGIN_SRC d
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),
@@ -1826,10 +1825,13 @@ comp_obj_toc.attrib.indent_hang = indent["hang_position"];
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;
@@ -1837,10 +1839,13 @@ if (the_endnotes_section.length > 1) {
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;
@@ -1848,10 +1853,13 @@ if (the_glossary_section.length > 1) {
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;
@@ -1859,10 +1867,13 @@ if (the_bibliography_section.length > 1){
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;
@@ -1870,10 +1881,13 @@ if (the_bookindex_section.length > 1) {
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;
@@ -5061,10 +5075,18 @@ char[] font_faces_line()(
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;
}
@@ -5856,10 +5878,13 @@ static struct ObjInlineMarkup {
"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;
@@ -5898,10 +5923,13 @@ static struct ObjInlineMarkup {
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/org/spine.org b/org/spine.org
index 1ecf248..27dfdc1 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -735,19 +735,15 @@ auto program_info() {
return program_name;
}
string ver() {
- string ver_ = format(
- "%s.%s.%s",
+ return format("%s.%s.%s",
_ver.major, _ver.minor, _ver.patch,
);
- return ver_;
}
string compiler() {
- string ver_ = format(
- "%s D:%s, %s %s",
+ return format ("%s D:%s, %s %s",
__VENDOR__, __VERSION__,
bits, os,
);
- return ver_;
}
}
return ProgramInfo();
@@ -1355,8 +1351,7 @@ struct DocumentMatters {
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.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<last>\S.+?),\s+(?P<first>.+)`,"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");
diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d
index 134854e..8108acb 100755
--- a/src/doc_reform/spine.d
+++ b/src/doc_reform/spine.d
@@ -514,19 +514,15 @@ void main(string[] args) {
return program_name;
}
string ver() {
- string ver_ = format(
- "%s.%s.%s",
+ return format("%s.%s.%s",
_ver.major, _ver.minor, _ver.patch,
);
- return ver_;
}
string compiler() {
- string ver_ = format(
- "%s D:%s, %s %s",
+ return format ("%s D:%s, %s %s",
__VENDOR__, __VERSION__,
bits, os,
);
- return ver_;
}
}
return ProgramInfo();