aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/meta/metadoc_from_src.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/meta/metadoc_from_src.d')
-rw-r--r--src/sdp/meta/metadoc_from_src.d63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d
index 54bedfe..627b37a 100644
--- a/src/sdp/meta/metadoc_from_src.d
+++ b/src/sdp/meta/metadoc_from_src.d
@@ -358,6 +358,7 @@ template SiSUdocAbstraction() {
string[] html_segnames=["toc"];
int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
/+ abstraction init ↑ +/
+ enum Substitute { match, markup, }
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
if (!(conf_make_meta.make.headings.empty)) {
@@ -365,21 +366,21 @@ template SiSUdocAbstraction() {
}
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
- writeln("regex to match: ", substitution_pair[0]);
- writeln("substitution to make: ", substitution_pair[1]);
+ writeln("regex to match: ", substitution_pair[Substitute.match]);
+ writeln("substitution to make: ", substitution_pair[Substitute.markup]);
}
}
- if (!(conf_make_meta.make.bold_rgxmatch == "=NULL" || conf_make_meta.make.bold_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.bold_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.bold_substitute_html);
+ if (conf_make_meta.make.bold) {
+ writeln("regex to match: ", conf_make_meta.make.bold[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.bold[Substitute.markup]);
}
- if (!(conf_make_meta.make.emphasis_rgxmatch == "=NULL" || conf_make_meta.make.emphasis_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.emphasis_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.emphasis_substitute_html);
+ if (conf_make_meta.make.emphasis) {
+ writeln("regex to match: ", conf_make_meta.make.emphasis[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.emphasis[Substitute.markup]);
}
- if (!(conf_make_meta.make.italics_rgxmatch == "=NULL" || conf_make_meta.make.italics_rgxmatch.empty)) {
- writeln("regex to match: ", conf_make_meta.make.italics_rgxmatch);
- writeln("substitution to make: ", conf_make_meta.make.italics_substitute_html);
+ if (conf_make_meta.make.italics) {
+ writeln("regex to match: ", conf_make_meta.make.italics[Substitute.match]);
+ writeln("substitution to make: ", conf_make_meta.make.italics[Substitute.markup]);
}
}
/+ ↓ loop markup document/text line by line +/
@@ -626,12 +627,14 @@ template SiSUdocAbstraction() {
continue;
} else if (obj_type_status["quote"] == TriState.on) {
/+ within block object: quote +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_quote_block_(line, an_object, obj_type_status);
continue;
/+ within block object: group +/
} else if (obj_type_status["group"] == TriState.on) {
/+ 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)
.replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1");
@@ -639,6 +642,7 @@ template SiSUdocAbstraction() {
continue;
} else if (obj_type_status["block"] == TriState.on) {
/+ within block object: block +/
+ 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)
@@ -673,7 +677,6 @@ template SiSUdocAbstraction() {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
- line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
} else if (!line.empty) {
@@ -751,10 +754,12 @@ template SiSUdocAbstraction() {
+/
if (line.matchFirst(rgx.heading)) {
/+ heading match +/
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
_heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, conf_make_meta);
} else if (line_occur["para"] == State.off) {
/+ para match +/
an_object_key="body_nugget";
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur);
}
@@ -770,6 +775,7 @@ template SiSUdocAbstraction() {
debug(para) {
writeln(an_object_key, "-> ", line);
}
+ line = _doc_header_and_make_substitutions_(line, conf_make_meta);
line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
an_object[an_object_key] ~= " " ~ line;
++line_occur["para"];
@@ -1955,11 +1961,12 @@ template SiSUdocAbstraction() {
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
+ enum Substitute { match, markup, }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
line = line.replaceAll(
- regex(substitution_pair[0]),
- substitution_pair[1]
+ regex(substitution_pair[Substitute.match]),
+ substitution_pair[Substitute.markup]
);
}
}
@@ -1972,31 +1979,23 @@ template SiSUdocAbstraction() {
debug(asserts) {
static assert(is(typeof(line) == char[]));
}
- if (!(
- conf_make_meta.make.bold_rgxmatch == "=NULL"
- || conf_make_meta.make.bold_rgxmatch.empty
- )) {
+ enum Substitute { match, markup, }
+ if ( conf_make_meta.make.bold) {
line = line.replaceAll(
- regex(conf_make_meta.make.bold_rgxmatch),
- conf_make_meta.make.bold_substitute_sisu_markup
+ regex(conf_make_meta.make.bold[Substitute.match]),
+ conf_make_meta.make.bold[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.emphasis_rgxmatch == "=NULL"
- || conf_make_meta.make.emphasis_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.emphasis) {
line = line.replaceAll(
- regex(conf_make_meta.make.emphasis_rgxmatch),
- conf_make_meta.make.emphasis_substitute_sisu_markup
+ regex(conf_make_meta.make.emphasis[Substitute.match]),
+ conf_make_meta.make.emphasis[Substitute.markup]
);
}
- if (!(
- conf_make_meta.make.italics_rgxmatch == "=NULL"
- || conf_make_meta.make.italics_rgxmatch.empty
- )) {
+ if (conf_make_meta.make.italics) {
line = line.replaceAll(
- regex(conf_make_meta.make.italics_rgxmatch),
- conf_make_meta.make.italics_substitute_sisu_markup
+ regex(conf_make_meta.make.italics[Substitute.match]),
+ conf_make_meta.make.italics[Substitute.markup]
);
}
return line;