aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_abstraction.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r--org/meta_abstraction.org131
1 files changed, 105 insertions, 26 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index 3f5ba11..d6d687e 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -82,6 +82,7 @@ template DocReformDocAbstraction() {
/+ ↓ post loop markup document/text +/
<<abs_post>>
<<abs_post_doc_reloop_processing>>
+ <<abs_struct_doc_has>>
<<abs_return_tuple>>
/+ post loop markup document/text ↑ +/
} /+ ← closed: abstract doc source +/
@@ -526,6 +527,18 @@ line_occur = [
"glossary" : 0,
"blurb" : 0,
];
+uint[string] dochas = [
+ "inline_links" : 0,
+ "inline_notes" : 0,
+ "inline_notes_star" : 0,
+ "codeblock" : 0,
+ "table" : 0,
+ "block" : 0,
+ "group" : 0,
+ "poem" : 0,
+ "quote" : 0,
+ "images" : 0,
+];
auto obj_type_status = flags_type_init;
string[string] object_number_poem = [
"start" : "",
@@ -1085,7 +1098,7 @@ if (line.matchFirst(rgx.block_poem_open)) { /
processing.remove("verse");
object_number_poem["start"] = obj_cite_digits.object_number.to!string;
}
-line.flow_txt_block_start(obj_type_status, object_number_poem);
+line.flow_txt_block_start(obj_type_status, dochas, object_number_poem);
continue;
#+END_SRC
@@ -2315,7 +2328,7 @@ auto extract_images(S)(S content_block) {
}
return images_;
}
-string[] segnames_lv0_to_4;
+string[] segnames_0_to_4;
#+END_SRC
****** images: dimensions
@@ -2405,7 +2418,7 @@ foreach (ref obj; the_document_head_section) {
writeln(obj.text);
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
}
if (obj.metainfo.heading_lev_markup == 0) {
/+ TODO second hit (of two) with same assertion failure, check, fix and reinstate
@@ -2443,7 +2456,7 @@ if (the_table_of_contents_section.length > 1) {
foreach (ref obj; the_table_of_contents_section) {
if (obj.metainfo.is_a == "heading") {
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1];
assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames],
@@ -2489,7 +2502,7 @@ if (the_document_body_section.length > 1) {
writeln(obj.text);
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.anchor_tag_html];
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
@@ -2518,7 +2531,7 @@ if (the_document_body_section.length > 1) {
obj = _links(obj);
}
}
-auto images=uniq(_images.sort());
+auto image_list = (_images.sort()).uniq;
#+END_SRC
***** ↻ Loop section: endnotes [en]
@@ -2542,7 +2555,7 @@ if (the_endnotes_section.length > 1) {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
if (segnames["html"].length > obj.ptr.html_segnames + 1) {
@@ -2586,7 +2599,7 @@ if (the_glossary_section.length > 1) {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
if (segnames["html"].length > obj.ptr.html_segnames + 1) {
@@ -2634,7 +2647,7 @@ if (the_bibliography_section.length > 1) {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
if (segnames["html"].length > obj.ptr.html_segnames + 1) {
@@ -2683,7 +2696,7 @@ if (the_bookindex_section.length > 1) { /
debug(dom) {
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
}
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.object_number;
@@ -2740,7 +2753,7 @@ if (the_blurb_section.length > 1) {
obj.metainfo.ocn = obj_cite_digits.object_number;
obj.metainfo.identifier = obj_cite_digits.identifier;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub;
+ segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1];
if (segnames["html"].length > obj.ptr.html_segnames + 1) {
@@ -2967,17 +2980,16 @@ if ((opt_action.html)
document_section_keys_sequenced["scroll"] ~= "tail";
document_section_keys_sequenced["seg"] ~= "tail";
}
-auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced);
#+END_SRC
*** dup
#+name: abs_post
#+BEGIN_SRC d
-auto segnames_lv4 = segnames["html"].dup;
+auto segnames_4 = segnames["html"].dup;
auto segnames_lv1_to_4 = segnames["epub"].dup;
debug(segnames) {
- writeln("segnames_lv4: ", segnames_lv4);
+ writeln("segnames_lv4: ", segnames_4);
writeln("segnames_lv1_to_4: ", segnames_lv1_to_4);
}
#+END_SRC
@@ -3009,17 +3021,69 @@ dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
#+END_SRC
+*** doc_has struct
+
+#+name: abs_struct_doc_has
+#+BEGIN_SRC d
+auto doc_has() {
+ struct DocHas_ {
+ uint inline_links() {
+ return dochas["inline_links"];
+ }
+ uint inline_notes_reg() {
+ return dochas["inline_notes"];
+ }
+ uint inline_notes_star() {
+ return dochas["inline_notes_star"];
+ }
+ uint codeblocks() {
+ return dochas["codeblock"];
+ }
+ uint tables() {
+ return dochas["table"];
+ }
+ uint blocks() {
+ return dochas["block"];
+ }
+ uint groups() {
+ return dochas["group"];
+ }
+ uint poems() {
+ return dochas["poem"];
+ }
+ uint quotes() {
+ return dochas["quote"];
+ }
+ ulong images() { // TODO not ideal rethink
+ return (image_list.to!string.strip("[","]").split(",").length);
+ }
+ auto imagelist() {
+ return image_list;
+ }
+ auto keys_seq() {
+ return docSectKeysSeq!()(document_section_keys_sequenced);
+ }
+ string[] segnames_lv4() {
+ return segnames_4;
+ }
+ string[] segnames_lv_0_to_4() {
+ return segnames_0_to_4;
+ }
+ string[string][string] tag_associations() {
+ return tag_assoc;
+ }
+ }
+ return DocHas_();
+}
+#+END_SRC
+
*** _return document tuple_ [#A] :return:tuple:
#+name: abs_return_tuple
#+BEGIN_SRC d
auto t = tuple(
document_the,
- sequenced_document_keys,
- segnames_lv4,
- segnames_lv0_to_4,
- tag_assoc,
- images,
+ doc_has,
);
return t;
#+END_SRC
@@ -3203,9 +3267,10 @@ auto _doc_header_and_make_substitutions_fontface_(L,CMM)(
#+name: abs_functions_block
#+BEGIN_SRC d
void flow_txt_block_start(L,T,N)(
- L line,
- return ref T obj_type_status,
- return ref N object_number_poem
+ L line,
+ return ref T obj_type_status,
+ return ref uint[string] dochas,
+ return ref N object_number_poem
) {
debug(asserts) {
static assert(is(typeof(line) == char[]));
@@ -3226,6 +3291,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
if (auto m = line.matchFirst(rgx.block_curly_code_open)) {
+ dochas["codeblock"]++;
an_object["lang"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
@@ -3245,6 +3311,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) {
+ dochas["poem"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3266,6 +3333,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_group_open)) {
+ dochas["group"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3285,6 +3353,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_block_open)) {
+ dochas["block"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3304,6 +3373,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) {
+ dochas["quote"]++;
an_object["syntax"] = "";
an_object["attrib"] = m["attrib"].to!string;
an_object["lang"] = m["lang"].to!string;
@@ -3329,6 +3399,7 @@ void flow_txt_block_start(L,T,N)(
line
);
}
+ dochas["table"] ++;
an_object["table_head"] = m["attrib"].to!string;
an_object["block_type"] = "curly";
obj_type_status["blocks"] = TriState.on;
@@ -3341,6 +3412,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/
+ dochas["table"]++;
an_object["table_head"] = m["attrib"].to!string;
an_object["block_type"] = "special";
obj_type_status["blocks"] = TriState.on;
@@ -3354,6 +3426,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
+ dochas["codeblock"]++;
an_object["lang"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["syntax"] = (m["syntax"]) ? m["syntax"].to!string : "";
@@ -3373,6 +3446,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) {
+ dochas["poem"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3394,6 +3468,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_group_open)) {
+ dochas["group"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3413,6 +3488,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_block_open)) {
+ dochas["block"]++;
an_object["syntax"] = "";
an_object["attrib"] = (m["attrib"]) ? m["attrib"].to!string : "";
an_object["lang"] = (m["lang"]) ? m["lang"].to!string : "";
@@ -3432,6 +3508,7 @@ void flow_txt_block_start(L,T,N)(
#+name: abs_functions_block
#+BEGIN_SRC d
} else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) {
+ dochas["quote"]++;
an_object["syntax"] = "";
an_object["attrib"] = m["attrib"].to!string;
an_object["lang"] = m["lang"].to!string;
@@ -3457,6 +3534,7 @@ void flow_txt_block_start(L,T,N)(
line
);
}
+ dochas["table"] ++;
an_object["table_head"] = m["attrib"].to!string;
an_object["block_type"] = "tic";
obj_type_status["blocks"] = TriState.on;
@@ -7788,13 +7866,13 @@ pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status
template docSectKeysSeq() {
auto docSectKeysSeq(string[][string] document_section_keys_sequenced) {
struct doc_sect_keys_seq {
- auto scroll() {
+ string[] scroll() {
return document_section_keys_sequenced["scroll"];
}
- auto seg() {
+ string[] seg() {
return document_section_keys_sequenced["seg"];
}
- auto sql() {
+ string[] sql() {
return document_section_keys_sequenced["sql"];
}
}
@@ -7933,10 +8011,11 @@ struct DocObj_TxtAttrib_ {
#+name: meta_structs_init
#+BEGIN_SRC d
-struct DocObj_Has_ { // has
+struct DocObj_Has_ { // doc object has
bool inline_links = false;
bool inline_notes_reg = false;
bool inline_notes_star = false;
+ bool images = false;
bool image_without_dimensions = false;
}
#+END_SRC