aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-06-14 23:25:36 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-04 14:48:18 -0400
commit9bec897cdada305cae8ce78809dc3f9fe9cf8776 (patch)
treed05d0e4f2d9a9b2c5273e0a33bbbdf84580543b2 /src/sdp.d
parentstep4 some additional work (diff)
step4.1 as step4 but extract header meta & make on first reading in documentdoc-reform_v0.0.4
Diffstat (limited to 'src/sdp.d')
-rwxr-xr-xsrc/sdp.d81
1 files changed, 45 insertions, 36 deletions
diff --git a/src/sdp.d b/src/sdp.d
index 624b239..d17c379 100755
--- a/src/sdp.d
+++ b/src/sdp.d
@@ -8,11 +8,12 @@ import
compile_time_info, // sdp/compile_time_info.d
ao_abstract_doc_source, // sdp/ao_abstract_doc_source.d
ao_defaults, // sdp/ao_defaults.d
+ ao_header_extract, // sdp/ao_header_extract.d
ao_read_source_files, // sdp/ao_read_source_files.d
ao_output_debugs, // sdp/ao_output_debugs.d
- output_hub, // output_hub.d
ao_rgx, // sdp/ao_rgx.d
- ao_ansi_colors; // sdp/ao_ansi_colors.d
+ ao_ansi_colors, // sdp/ao_ansi_colors.d
+ output_hub; // output_hub.d
// std.conv;
/+ sdp sisu document parser +/
private import
@@ -40,28 +41,19 @@ mixin CompileTimeInfo;
mixin RgxInit;
void main(string[] args) {
- mixin SiSUheader;
- mixin SiSUbiblio;
- mixin SiSUrgxInitFlags;
- mixin SiSUmarkupRaw;
- mixin SiSUdocAbstraction;
- mixin SiSUoutputDebugs;
- mixin SiSUoutputHub;
- mixin ScreenTxtColors;
struct SDPoutput {
auto hub(S)(
auto ref const S contents,
string[][string][string] bookindex_unordered_hashes,
JSONValue[] biblio,
- JSONValue[string] dochead_make,
- JSONValue[string] dochead_meta,
+ // JSONValue[string] dochead_make_json,
+ // JSONValue[string] dochead_meta_json,
string fn_src,
bool[string] opt_action_bool
) {
mixin ScreenTxtColors;
mixin RgxInit;
mixin SiSUoutputHub;
- // mixin SiSUoutput;
auto rgx = Rgx();
uint return_ = 0;
if (opt_action_bool["source"]) {
@@ -79,8 +71,8 @@ void main(string[] args) {
if (opt_action_bool["html"]) {
auto html=SDPoutputHTML();
html.css_write;
- // html.scroll(contents, bookindex_unordered_hashes, biblio, fn_src, opt_action_bool);
- html.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make, dochead_meta, fn_src, opt_action_bool);
+ html.scroll(contents, bookindex_unordered_hashes, biblio, fn_src, opt_action_bool);
+ // html.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make_json, dochead_meta_json, fn_src, opt_action_bool);
}
if (opt_action_bool["epub"]) {
writeln("epub processing");
@@ -100,14 +92,25 @@ void main(string[] args) {
return return_;
}
}
+ mixin SiSUheaderSkel;
+ mixin SiSUheaderExtract;
+ mixin SiSUbiblio;
+ mixin SiSUrgxInitFlags;
+ // mixin SiSUconfiguration;
+ mixin SiSUmarkupRaw;
+ mixin SiSUdocAbstraction;
+ mixin SiSUoutputDebugs;
+ mixin SiSUoutputHub;
+ mixin ScreenTxtColors;
auto raw = MarkupRaw();
+ auto head = HeaderDocMetadataMakeJson();
auto abs = Abstraction();
auto dbg = SDPoutputDebugs();
auto output = SDPoutput();
/+
struct DocumentParts {
string[string][] contents;
- JSONValue[string] metadata_json;
+ JSONValue[string] meta_json;
JSONValue[string] make_json;
string[][string][string] bookindex_unordered_hashes;
JSONValue[] biblio;
@@ -120,8 +123,7 @@ void main(string[] args) {
scope(success) {
debug(checkdoc) {
writefln(
- "%s~ run complete, ok ~ %s (sdp-%s.%s.%s, %s v%s, %s %s)",
- scr_txt_color["cyan"], scr_txt_color["off"],
+ "~ run complete, ok ~ (sdp-%s.%s.%s, %s v%s, %s %s)",
ver.major, ver.minor, ver.patch,
__VENDOR__, __VERSION__,
bits, os,
@@ -203,10 +205,7 @@ void main(string[] args) {
if (!empty(fn_src)) {
scope(success) {
debug(checkdoc) {
- writefln(
- "%s~ document complete, ok ~%s",
- scr_txt_color["green"], scr_txt_color["off"],
- );
+ writeln("~ document complete, ok ~");
}
// stderr.writeln("0");
}
@@ -226,17 +225,27 @@ void main(string[] args) {
"not a sisu markup filename"
);
/+ ↓ read file +/
- auto sourcefile_content =
- raw.sourceContent(fn_src);
+ auto header_and_content_tuple = raw.sourceContent(fn_src);
+ static assert(!isTypeTuple!(header_and_content_tuple));
+ auto header = header_and_content_tuple[0];
+ auto sourcefile_content = header_and_content_tuple[1];
+ debug(header_and_content) {
+ writeln(header);
+ writeln(header_and_content_tuple.length);
+ writeln(sourcefile_content[0]);
+ }
+ /+ ↓ headers metadata & make +/
+ auto header_content = head.headerContentJSON(header);
+ static assert(!isTypeTuple!(header_content));
+ auto dochead_make_json = header_content[0];
+ auto dochead_meta_json = header_content[1];
/+ ↓ porcess document, return abstraction as tuple +/
- auto t = abs.abstract_doc_source(sourcefile_content);
+ auto t = abs.abstract_doc_source(sourcefile_content, dochead_make_json, dochead_meta_json);
static assert(!isTypeTuple!(t));
auto doc_ao_contents = t[0]; // contents ~ endnotes ~ bookindex;
// static assert(!isIterable!(doc_ao_contents));
- auto doc_ao_metadata_json = t[1];
- auto doc_ao_make_json = t[2];
- auto doc_ao_bookindex_unordered_hashes = t[3];
- auto doc_ao_biblio = t[4];
+ auto doc_ao_bookindex_unordered_hashes = t[1];
+ auto doc_ao_biblio = t[2];
// destroy(t);
/+ ↓ document parts +/
debug(checkdoc) { // checkbook & dumpdoc
@@ -244,8 +253,8 @@ void main(string[] args) {
doc_ao_contents,
doc_ao_bookindex_unordered_hashes,
doc_ao_biblio,
- doc_ao_make_json,
- doc_ao_metadata_json,
+ dochead_make_json,
+ dochead_meta_json,
fn_src,
opt_action_bool
);
@@ -255,8 +264,8 @@ void main(string[] args) {
doc_ao_contents,
doc_ao_bookindex_unordered_hashes,
doc_ao_biblio,
- doc_ao_make_json,
- doc_ao_metadata_json,
+ // doc_ao_make_json,
+ // doc_ao_meta_json,
fn_src,
opt_action_bool
);
@@ -270,9 +279,9 @@ void main(string[] args) {
destroy(sourcefile_content);
destroy(t);
destroy(doc_ao_contents);
- destroy(doc_ao_make_json);
- destroy(doc_ao_metadata_json);
- destroy(doc_ao_bookindex_unordered_hashes);
+ // destroy(doc_ao_make_json);
+ // destroy(doc_ao_meta_json);
+ // destroy(doc_ao_bookindex_unordered_hashes);
destroy(doc_ao_biblio);
destroy(fn_src);
}