1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/++
output hub<BR>
check & generate output types requested
+/
module sdp.meta.composite_make;
template compositeMkCnf() {
import sdp.meta;
import std.array;
mixin SiSUrgxInit;
string[] _substitutions;
string[string][] _sub;
string _bold;
string _italics;
string _emphasis;
auto compositeMkCnf(Mks...)(Mks makes) {
static auto rgx = Rgx();
foreach (make; makes) {
if (auto z = "make" in make) {
if (auto x = "substitute" in *z) {
foreach (m; (*x).matchAll(rgx.make_simple_substitutions_d)) {
_sub ~= ["match": (m["match"]), "replace": (m["replace"])];
_substitutions ~= format("`%s`,\"%s\"",
m["match"],
m["replace"],
);
}
foreach (m; (*x).matchAll(rgx.make_simple_substitutions_rb)) {
_sub ~= ["match": (m["match"]), "replace": (m["replace"])];
_substitutions ~= format("`%s`,\"%s\"",
m["match"],
m["replace"],
);
}
}
if (auto x = "bold" in *z) {
_bold = (*x).to!string;
}
if (auto x = "italics" in *z) {
_italics = (*x).to!string;
}
if (auto x = "emphasis" in *z) {
_emphasis = (*x).to!string;
}
}
}
struct _composite_make {
auto substitutions() {
auto _k = _sub;
return _k;
}
auto substitute() {
auto _k = _substitutions;
return _k;
}
auto italics() {
auto _k = _italics;
return _k;
}
auto bold() {
auto _k = _bold;
return _k;
}
auto emphasis() {
auto _k = _emphasis;
return _k;
}
}
return _composite_make();
}
}
/++
output hub<BR>
check & generate output types requested
+/
template compositeMkCnfAA() {
import sdp.meta;
import std.array;
mixin SiSUrgxInit;
string[] _substitutions;
string[string][] _sub;
static auto rgx = Rgx();
auto compositeMkCnfAA(Mks...)(Mks makes) {
/+
- skip.first_make which is the "composite make output"
- pass config files as associative arrays,
- skip.last_make which is getopt, treat separately
+/
auto _composite_make = makes[0];
auto _opts = makes[$-1];
foreach (make; makes[1..$-1]) {
if (auto z = "make" in make) { // document head: make (part of individual document)
if (auto x = "substitute" in *z) {
_composite_make["make"]["substitute"] = *x;
}
if (auto x = "italics" in *z) {
_composite_make["make"]["italics"] = *x;
}
if (auto x = "bold" in *z) {
_composite_make["make"]["bold"] = *x;
}
if (auto x = "emphasis" in *z) {
_composite_make["make"]["emphasis"] = *x;
}
}
}
/+ logic for adding _opts make instructions to _composite make +/
return _composite_make;
}
}
|