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
110
111
|
template SiSUpod() {
private import
std.algorithm,
std.array,
std.container,
std.exception,
std.file,
std.getopt,
std.json,
std.process,
std.stdio,
std.path,
std.range,
std.regex,
std.string,
std.traits,
std.typecons,
std.uni,
std.utf,
defaults;
import
ao_rgx,
output_xhtmls;
void SiSUpod(T)(T doc_matters) {
debug(asserts){
// static assert(is(typeof(doc_matters) == tuple));
}
mixin SiSUrgxInit;
mixin SiSUpaths;
auto pth_sisupod = SiSUpodPaths();
mixin SiSUlanguageCodes;
auto lang = Lang();
auto rgx = Rgx();
assert (match(doc_matters.source_filename, rgx.src_fn));
try {
/+ create directory structure +/
if (!exists(pth_sisupod.doc(doc_matters.source_filename))) {
mkdirRecurse(pth_sisupod.doc(doc_matters.source_filename));
}
if (!exists(pth_sisupod.conf(doc_matters.source_filename))) {
mkdirRecurse(pth_sisupod.conf(doc_matters.source_filename));
}
if (!exists(pth_sisupod.css(doc_matters.source_filename))) {
mkdirRecurse(pth_sisupod.css(doc_matters.source_filename));
}
if (!exists(pth_sisupod.image(doc_matters.source_filename))) {
mkdirRecurse(pth_sisupod.image(doc_matters.source_filename));
}
if (!exists(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language))) {
mkdirRecurse(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language));
}
debug(sisupod) {
writeln(__LINE__, ": ",
// doc_matters.environment["pwd"], "/",
doc_matters.source_filename, " -> ",
// doc_matters.environment["pwd"], "/",
pth_sisupod.fn_doc(
doc_matters.source_filename,
doc_matters.language
));
}
if (exists(doc_matters.source_filename)) {
copy(
doc_matters.source_filename,
pth_sisupod.fn_doc(
doc_matters.source_filename,
doc_matters.language
));
}
if (doc_matters.file_insert_list.length > 0) {
foreach (insert_file; doc_matters.file_insert_list) {
debug(sisupod) {
writeln(
insert_file, " -> ",
pth_sisupod.fn_doc_insert(
doc_matters.source_filename,
insert_file,
doc_matters.language
));
}
if (exists(insert_file)) {
copy(
insert_file,
pth_sisupod.fn_doc_insert(
doc_matters.source_filename,
insert_file,
doc_matters.language
));
}
}
}
foreach (image; doc_matters.image_list) {
debug(sisupod) {
writeln(
"_sisu/image/", image, " -> ",
pth_sisupod.image(doc_matters.source_filename), "/", image
);
}
if (exists("_sisu/image/"~ image)) {
copy(
("_sisu/image/"~ image),
(pth_sisupod.image(doc_matters.source_filename) ~ "/" ~ image)
);
}
}
}
catch (ErrnoException ex) {
// Handle error
}
}
}
|