aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2018-12-30 20:55:09 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:38 -0400
commitac868b590106763c2b3223a1af5cf9f49cce6ca5 (patch)
tree6865d4ce6e8441a5c9922097828ad9ddf1658c01 /src/doc_reform
parent0.3.3 org mode behavior (diff)
Diffstat (limited to 'src/doc_reform')
-rwxr-xr-xsrc/doc_reform/doc_reform.d10
-rw-r--r--src/doc_reform/meta/conf_make_meta_structs.d2
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d48
-rw-r--r--src/doc_reform/output/sqlite.d8
-rw-r--r--src/doc_reform/output/xmls.d14
5 files changed, 42 insertions, 40 deletions
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,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
@@ -421,7 +421,7 @@ template SQLiteFormatAndLoadObject() {
"</p>"
);
}
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
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, "&#38;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
.replaceAll(rgx.xhtml_less_than, "&#60;")
@@ -61,7 +61,7 @@ template outputXHTMLs() {
return _txt;
}
string special_characters_text(string _txt){
- _txt = (_txt)
+ _txt = _txt
.replaceAll(rgx.xhtml_ampersand, "&#38;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
.replaceAll(rgx.xhtml_less_than, "&#60;")
@@ -70,7 +70,7 @@ template outputXHTMLs() {
return _txt;
}
string font_face(string _txt){
- _txt = (_txt)
+ _txt = _txt
.replaceAll(rgx.inline_emphasis, ("<em>$1</em>"))
.replaceAll(rgx.inline_bold, ("<b>$1</b>"))
.replaceAll(rgx.inline_underscore, ("<u>$1</u>"))
@@ -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,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);
@@ -481,7 +481,7 @@ template outputXHTMLs() {
"</p>"
);
}
- _txt = (_txt).replaceAll(
+ _txt = _txt.replaceAll(
rgx.inline_notes_delimiter_al_regular_number_note,
("<a href=\"#note_$1\"><note id=\"noteref_$1\">&#160;<sup>$1</sup> </note></a>")
);