aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_abstraction.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-02-28 17:18:16 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitc3a2508f2acfdffbde46e237071c9775ce2ff519 (patch)
treeb79a5f8aa92b2d642a017ff4091e7ba343773bb2 /org/meta_abstraction.org
parent(header, doc make, config) add checks to toml (diff)
header make unmarked headings
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r--org/meta_abstraction.org76
1 files changed, 46 insertions, 30 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index d112a51..03da5cf 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -540,6 +540,9 @@ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
#+BEGIN_SRC d
debug (substitutions) {
writeln(__LINE__, ":", __FILE__, ": DEBUG substitutions:");
+ if (!(conf_make_meta.make.headings.empty)) {
+ writeln(conf_make_meta.make.headings);
+ }
if (conf_make_meta.make.substitute) {
foreach(substitution_pair; conf_make_meta.make.substitute) {
writeln("regex to match: ", substitution_pair[0]);
@@ -854,7 +857,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} 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;
#+END_SRC
@@ -866,7 +869,7 @@ if there is a blurb section you need to:
/+ 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");
_group_block_(line, an_object, obj_type_status);
@@ -879,7 +882,7 @@ if there is a blurb section you need to:
#+BEGIN_SRC d
} 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)
.replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ]));
@@ -935,7 +938,7 @@ if (line.matchFirst(rgx.block_poem_open)) {
processing.remove("verse");
obj_cite_number_poem["start"] = obj_cite_digits.on.to!string;
}
-line = _doc_header_and_make_substitutions_(line, conf_make_meta);
+line = _doc_header_and_make_substitutions_fontface_(line, conf_make_meta);
_start_block_(line, obj_type_status, obj_cite_number_poem);
continue;
#+END_SRC
@@ -1045,7 +1048,7 @@ if (line.matchFirst(rgx.book_index)
} 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);
}
#+END_SRC
@@ -1072,7 +1075,7 @@ if (line.matchFirst(rgx.book_index)
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"];
}
@@ -2560,6 +2563,7 @@ static auto _check_ocn_status_(L,T)(
#+END_SRC
*** make substitutions
+**** project
#+name: abs_functions_substitutions
#+BEGIN_SRC d
@@ -2578,6 +2582,21 @@ auto _doc_header_and_make_substitutions_(L,CMM)(
);
}
}
+ return line;
+}
+#+END_SRC
+
+**** fontface
+
+#+name: abs_functions_substitutions
+#+BEGIN_SRC d
+auto _doc_header_and_make_substitutions_fontface_(L,CMM)(
+ L line,
+ CMM conf_make_meta,
+) {
+ debug(asserts) {
+ static assert(is(typeof(line) == char[]));
+ }
if (!(
conf_make_meta.make.bold_rgxmatch == "=NULL"
|| conf_make_meta.make.bold_rgxmatch.empty
@@ -3993,85 +4012,82 @@ auto _book_index_(L,I,O,T,B)(
#+BEGIN_SRC d
auto _heading_found_(L,X,H,R,T)(
L line,
- X dochead_make_identify_unmarked_headings,
+ X _make_unmarked_headings,
return ref H heading_match_str,
return ref R heading_match_rgx,
return ref T obj_type_status
) {
debug(asserts) {
static assert(is(typeof(line) == char[]));
- static assert(is(typeof(dochead_make_identify_unmarked_headings) == string));
+ static assert(is(typeof(_make_unmarked_headings) == string[]));
static assert(is(typeof(heading_match_str) == string[string]));
static assert(is(typeof(heading_match_rgx) == Regex!(char)[string]));
static assert(is(typeof(obj_type_status) == int[string]));
}
static auto rgx = Rgx();
- if ((dochead_make_identify_unmarked_headings.length > 2)
+ if ((_make_unmarked_headings.length > 2)
&& (obj_type_status["make_headings"] == State.off)) {
/+ headings found +/
debug(headingsfound) {
- writeln(dochead_make_identify_unmarked_headings);
+ writeln(_make_unmarked_headings);
}
- char[][] make_headings_spl
- = (cast(char[]) dochead_make_identify_unmarked_headings)
- .split(rgx.make_heading_delimiter);
debug(headingsfound) {
- writeln(make_headings_spl.length);
- writeln(make_headings_spl);
+ writeln(_make_unmarked_headings.length);
+ writeln(_make_unmarked_headings);
}
- switch (make_headings_spl.length) {
+ switch (_make_unmarked_headings.length) {
case 7 :
- if (!empty(make_headings_spl[6])) {
+ if (!empty(_make_unmarked_headings[6])) {
heading_match_str["h_4"]
- = "^(" ~ make_headings_spl[6].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[6].to!string ~ ")";
heading_match_rgx["h_4"]
= regex(heading_match_str["h_4"]);
}
goto case;
case 6 :
- if (!empty(make_headings_spl[5])) {
+ if (!empty(_make_unmarked_headings[5])) {
heading_match_str["h_3"]
- = "^(" ~ make_headings_spl[5].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[5].to!string ~ ")";
heading_match_rgx["h_3"]
= regex(heading_match_str["h_3"]);
}
goto case;
case 5 :
- if (!empty(make_headings_spl[4])) {
+ if (!empty(_make_unmarked_headings[4])) {
heading_match_str["h_2"]
- = "^(" ~ make_headings_spl[4].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[4].to!string ~ ")";
heading_match_rgx["h_2"]
= regex(heading_match_str["h_2"]);
}
goto case;
case 4 :
- if (!empty(make_headings_spl[3])) {
+ if (!empty(_make_unmarked_headings[3])) {
heading_match_str["h_1"]
- = "^(" ~ make_headings_spl[3].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[3].to!string ~ ")";
heading_match_rgx["h_1"]
= regex(heading_match_str["h_1"]);
}
goto case;
case 3 :
- if (!empty(make_headings_spl[2])) {
+ if (!empty(_make_unmarked_headings[2])) {
heading_match_str["h_D"]
- = "^(" ~ make_headings_spl[2].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[2].to!string ~ ")";
heading_match_rgx["h_D"]
= regex(heading_match_str["h_D"]);
}
goto case;
case 2 :
- if (!empty(make_headings_spl[1])) {
+ if (!empty(_make_unmarked_headings[1])) {
heading_match_str["h_C"]
- = "^(" ~ make_headings_spl[1].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[1].to!string ~ ")";
heading_match_rgx["h_C"]
= regex(heading_match_str["h_C"]);
}
goto case;
case 1 :
- if (!empty(make_headings_spl[0])) {
+ if (!empty(_make_unmarked_headings[0])) {
heading_match_str["h_B"]
- = "^(" ~ make_headings_spl[0].to!string ~ ")";
+ = "^(" ~ _make_unmarked_headings[0].to!string ~ ")";
heading_match_rgx["h_B"]
= regex(heading_match_str["h_B"]);
}