aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/sdp.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/sdp.org')
-rw-r--r--org/sdp.org177
1 files changed, 168 insertions, 9 deletions
diff --git a/org/sdp.org b/org/sdp.org
index 9cb677b..658c0b9 100644
--- a/org/sdp.org
+++ b/org/sdp.org
@@ -365,7 +365,11 @@ enforce(
);
#+END_SRC
-*** 1. _document abstraction_
+*** 1. _document abstraction_ [#A]
+
+- return tuple of:
+ - doc_abstraction (the document)
+ - doc_matters
#+NAME: sdp_abstraction
#+BEGIN_SRC d
@@ -378,7 +382,7 @@ auto doc_matters = t[1];
#+END_SRC
*** 2. _output processing_ (post abstraction processing)
-**** 0. abstraction summary :abstraction:summary:
+**** 0. abstraction _print summary_ :abstraction:summary:
#+NAME: sdp_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
@@ -434,8 +438,8 @@ writeln("no recognized filename");
break; // terminate, stop
#+END_SRC
-* 2. _document abstraction_
-** 0. abstraction template :template:
+* 2. _document abstraction functions_
+** 0. abstraction template [#A] :template:
#+BEGIN_SRC d :tangle ../src/sdp/abstraction.d
template SiSUabstraction() {
@@ -458,9 +462,19 @@ template SiSUabstraction() {
}
#+END_SRC
-** 1. (a) _read in raw file_ & (b) split content into: _doc header & doc content_
+** 1. (a) _read in raw file_ (b) split content into: _doc header & doc content_
- [[./ao_read_source_files.org][ao_read_source_files]]
+- read in the source marked up document and
+ - split the document into:
+ - document header
+ - document body
+ - if a master document make a list of insert files
+- return a tuple of:
+ - header
+ - body
+ - insert file list
+
#+NAME: sdp_each_file_do_read_and_split_sisu_markup_file_content_into_header_and_body
#+BEGIN_SRC d
/+ ↓ read file (filename with path) +/
@@ -476,9 +490,19 @@ debug(header_and_body) {
}
#+END_SRC
-** 2. split doc header into: _metadata & make_ :doc:header:metadata:make:
+** 2. _document metadata_ & _make instructions_ :doc:header:metadata:make:
- [[./ao_conf_make_meta.org][ao_conf_make_meta]]
+- read document header, split into:
+ - metadata
+ - make instructions
+- read config files
+ - consolidate make instructions
+- return tuple of:
+ - document metadata
+ - make instructions (from configuration files & document header make
+ instructions)
+
#+NAME: sdp_each_file_do_split_sisu_markup_file_header_into_make_and_meta
#+BEGIN_SRC d
/+ ↓ split header into make and meta +/
@@ -491,6 +515,17 @@ static assert(_0_make_1_dochead_meta_tuple.length==2);
** 3. _document abstraction, tuple_ (pre-processing) :processing:
- [[./ao_abstract_doc_source.org][ao_abstract_doc_source]]
+- prepare the document abstraction used in downstream processing
+
+- return tuple of:
+ - document abstraction (the_document or doc_abstraction)
+ - document abstraction keys
+ - (head, toc, body, endnotes, glossary, bibliography, bookindex, blurb,
+ tail)
+ - (passed in doc_matters)
+ - segnames for html epub (passed in doc_matters)
+ - image list (passed in doc_matters)
+
#+NAME: sdp_each_file_do_document_abstraction
#+BEGIN_SRC d
/+ ↓ document abstraction: process document, return abstraction as tuple +/
@@ -502,13 +537,16 @@ auto da = SiSUdocAbstraction!()(
);
static assert(!isTypeTuple!(da));
static assert(da.length==4);
-auto doc_abstraction = da[0]; // head ~ toc ~ contents ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb;
+auto doc_abstraction = da[0]; // head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~blurb;
string[][string] _document_section_keys_sequenced = da[1];
string[] _doc_html_segnames = da[2];
auto _images = da[3];
#+END_SRC
-** 4. _document matters_ (compiled from various sources)
+** 4. _document matters_ (doc info gathered, various sources)
+
+- prepare document_matters, miscellany about processing and the document of use
+ in downstream processing
#+NAME: sdp_each_file_do_document_matters
#+BEGIN_SRC d
@@ -530,7 +568,7 @@ struct DocumentMatters {
return _k;
}
auto dochead_meta() {
- string[string][string] _k = _0_make_1_dochead_meta_tuple[1];
+ string[string][string] _k = _0_make_1_dochead_meta_tuple[1];
return _k;
}
auto source_filename() {
@@ -556,3 +594,124 @@ struct DocumentMatters {
}
auto doc_matters = DocumentMatters();
#+END_SRC
+
+* 3. document abstraction _summary_ :summary:doc:
+** 0. template: :template:
+
+#+BEGIN_SRC d :tangle ../src/sdp/abstraction_summary.d
+template SiSUabstractionSummary() {
+ auto SiSUabstractionSummary(S,T)(
+ auto ref const S doc_abstraction,
+ auto ref T doc_matters,
+ ) {
+ <<abstraction_summary_imports>>
+ mixin InternalMarkup;
+ <<abstraction_summary_initialize>>
+ if (doc_matters.opt_action_bool["verbose"]) {
+ <<ao_abstraction_summary>>
+ }
+ }
+}
+#+END_SRC
+
+** init
+*** imports
+
+#+name: abstraction_summary_imports
+#+BEGIN_SRC d
+import
+ ao_defaults,
+ ao_rgx;
+import
+ std.array,
+ std.exception,
+ std.stdio,
+ std.regex,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ std.conv : to;
+#+END_SRC
+
+*** initialize :report:
+
+#+name: abstraction_summary_initialize
+#+BEGIN_SRC d
+auto markup = InlineMarkup();
+#+END_SRC
+
+** (last ocn)
+
+#+name: ao_abstraction_summary
+#+BEGIN_SRC d
+string[string] check = [
+ "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]",
+];
+foreach (k; doc_matters.keys_seq_seg) {
+ foreach (obj; doc_abstraction[k]) {
+ if (obj.use != "empty") {
+ if (!empty(obj.obj_cite_number)) {
+ check["last_obj_cite_number"] = obj.obj_cite_number;
+ }
+ }
+ }
+}
+#+END_SRC
+
+** summary
+
+#+name: ao_abstraction_summary
+#+BEGIN_SRC d
+// auto char_repeat_number = doc_matters.source_filename.length;
+// char_repeat_number = (char_repeat_number > 33)
+auto min_repeat_number = 66;
+auto char_repeat_number = (doc_matters.dochead_meta["title"]["full"].length
+ + doc_matters.dochead_meta["creator"]["author"].length + 4);
+char_repeat_number = (char_repeat_number > min_repeat_number)
+? char_repeat_number
+: min_repeat_number;
+// writeln(char_repeat_number);
+writefln(
+ "%s\n\"%s\", %s\n%s\n%s\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n%s%10d\n(%s: %s)\n%s",
+ markup.repeat_character_by_number_provided("-", char_repeat_number),
+ doc_matters.dochead_meta["title"]["full"],
+ doc_matters.dochead_meta["creator"]["author"],
+ doc_matters.source_filename,
+ markup.repeat_character_by_number_provided("-", char_repeat_number),
+ "length toc arr: ",
+ to!int(doc_abstraction["toc_seg"].length),
+ "length doc_abstraction arr: ",
+ to!int(doc_abstraction["body"].length),
+ "last obj_cite_number: ",
+ to!int(check["last_obj_cite_number"]),
+ "length endnotes: ",
+ (doc_abstraction["endnotes"].length > 1)
+ ? (to!int(doc_abstraction["endnotes"].length))
+ : 0,
+ "length glossary: ",
+ (doc_abstraction["glossary"].length > 1)
+ ? (to!int(doc_abstraction["glossary"].length))
+ : 0,
+ "length biblio: ",
+ (doc_abstraction["bibliography"].length > 1)
+ ? (to!int(doc_abstraction["bibliography"].length))
+ : 0,
+ "length bookindex: ",
+ (doc_abstraction["bookindex_seg"].length > 1)
+ ? (to!int(doc_abstraction["bookindex_seg"].length))
+ : 0,
+ "length blurb: ",
+ (doc_abstraction["blurb"].length > 1)
+ ? (to!int(doc_abstraction["blurb"].length))
+ : 0,
+ __FILE__,
+ __LINE__,
+ markup.repeat_character_by_number_provided("-", min_repeat_number),
+);
+#+END_SRC
+
+markup.repeat_character_by_number_provided("-", 10)
+markup.repeat_character_by_number_provided("-", (doc_matters.dochead_meta["title"]["full"].length))
+markup.repeat_character_by_number_provided("-", (doc_matters.source_filename.length))