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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/+
- Name: SisuDoc Spine, Doc Reform [a part of]
- Description: documents, structuring, processing, publishing, search
- static content generator
- Author: Ralph Amissah
[ralph.amissah@gmail.com]
- Copyright: (C) 2015 (continuously updated, current 2026) Ralph Amissah, All Rights Reserved.
- License: AGPL 3 or later:
Spine (SiSU), a framework for document structuring, publishing and
search
Copyright (C) Ralph Amissah
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU AFERO General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see [https://www.gnu.org/licenses/].
If you have Internet connection, the latest version of the AGPL should be
available at these locations:
[https://www.fsf.org/licensing/licenses/agpl.html]
[https://www.gnu.org/licenses/agpl.html]
- Spine (by Doc Reform, related to SiSU) uses standard:
- docReform markup syntax
- standard SiSU markup syntax with modified headers and minor modifications
- docReform object numbering
- standard SiSU object citation numbering & system
- Homepages:
[https://www.sisudoc.org]
[https://www.doc-reform.org]
- Git
[https://git.sisudoc.org/]
+/
module sisudoc.ocda.meta.metadoc;
@safe:
template spineAbstraction() {
import std.datetime;
import std.digest.crc;
import std.digest.sha;
import sisudoc.ocda.meta;
import sisudoc.ocda.meta.metadoc_from_src;
import sisudoc.ocda.meta.conf_make_meta_structs;
import sisudoc.ocda.meta.conf_make_meta_json;
import sisudoc.ocda.meta.defaults;
import sisudoc.ocda.io_in.paths_source;
import sisudoc.ocda.io_in.read_config_files;
import sisudoc.ocda.io_in.read_source_files;
import sisudoc.ocda.meta.doc_matters;
mixin spineDocMatters;
mixin spineBiblio;
enum makeMeta { make, meta }
enum docAbst { doc_abstract_obj, doc_has }
@system auto spineAbstraction(E,P,O,Cfg,M)(
E _env,
P program_info,
O _opt_action,
Cfg _cfg,
M _manifest,
ConfComposite _make_and_meta_struct
){
{ /+ document config/make file +/
auto _config_document_struct = readConfigDoc!()(_manifest, _env);
import sisudoc.ocda.meta.conf_make_meta_yaml;
_make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest, _opt_action, _cfg);
}
/+ ↓ read file (filename with path) +/
/+ ↓ file tuple of header and content +/
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("step1 commence → (get document header & body & insert file list & if needed image list) [", _manifest.src.filename, "]");
}
auto _header_body_insertfilelist_imagelist
= spineRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn);
auto doc_digests = _header_body_insertfilelist_imagelist.doc_digest; // CHECK, REVIEW, discard likely, other route taken
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("- step1 complete for [", _manifest.src.filename, "]");
}
debug(header_and_body) {
writeln(header);
writeln(_header_body_insertfilelist_imagelist.length);
// writeln(_header_body_insertfilelist_imagelist.length.body_content[0]);
}
/+ ↓ split header into make and meta +/
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("step2 commence → (read document header (yaml) return struct) [", _manifest.src.filename, "]");
}
import sisudoc.ocda.meta.conf_make_meta_yaml;
_make_and_meta_struct =
docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct!()(
_header_body_insertfilelist_imagelist.header_raw,
_make_and_meta_struct,
_manifest,
_opt_action,
_cfg,
);
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("- step2 complete for [", _manifest.src.filename, "]");
}
/+ ↓ document abstraction: process document, return abstraction as tuple +/
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters) [", _manifest.src.filename, "]");
}
auto da = docAbstraction!()(
_header_body_insertfilelist_imagelist.sourcefile_body_content,
_make_and_meta_struct,
_opt_action,
_manifest,
true,
);
auto doc_abstraction = da.document_the;
auto _doc_has_struct = da.doc_has;
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("- step3 complete for [", _manifest.src.filename, "]");
}
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("step4 commence → (doc.matters) [", _manifest.src.filename, "]");
}
/+ ↓ doc_matters, built by the one constructor a loaded abstraction also
uses, so that the two paths cannot describe a document differently
+/
auto doc_matters = docMattersMake(
program_info,
_opt_action,
_manifest,
_make_and_meta_struct,
_doc_has_struct,
doc_digests,
_header_body_insertfilelist_imagelist.insert_file_list,
);
if ((_opt_action.debug_do)
|| (_opt_action.debug_do_stages)
) {
writeln("- step4 complete for [", _manifest.src.filename, "]");
}
auto theDOC() {
struct ST_DOC {
const auto abstraction() {
return doc_abstraction;
}
auto matters() {
return doc_matters;
}
}
return ST_DOC();
}
auto the_doc = theDOC();
return the_doc;
}
}
|