aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index e1779ad..7374c76 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -1115,8 +1115,7 @@ template docAbstraction() {
if (line.matchFirst(rgx.book_index_item)
|| line.matchFirst(rgx.book_index_item_open)
|| pith["section"] == eN.sect.book_index) {
- // book_index
- {
+ { // book_index
auto _get = line.flow_book_index_(an_object, book_idx_tmp, pith, opt_action);
{
an_object = _get.this_object;
@@ -1544,7 +1543,7 @@ template docAbstraction() {
object_notes = _doc_by_line.object_notes; // endnotes, compare, not sure is used
destroy(_doc_by_line);
}
- { // EOF
+ { // EOF backMatter
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.metainfo.is_of_part = "backmatter";
comp_obj_heading_.metainfo.is_of_section = "tail";
@@ -1570,6 +1569,7 @@ template docAbstraction() {
tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html;
tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub;
}
+ // endNotes
auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); // endnotes, check
auto the_document_endnotes_section = en_tuple[0];
obj_cite_digits = en_tuple[1];
@@ -1577,6 +1577,7 @@ template docAbstraction() {
writefln("%s %s", __LINE__, the_document_endnotes_section.length);
foreach (o; the_document_endnotes_section) { writeln(o); }
}
+ // glossary
if (an_object["glossary_nugget"].length == 0) {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.metainfo.is_of_part = "empty";
@@ -1596,6 +1597,7 @@ template docAbstraction() {
the_document_glossary_section ~= comp_obj_heading_;
}
debug(glossary) { foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } }
+ // bibliography
auto biblio_unsorted_incomplete = biblio_arr_json.dup;
auto biblio = Bibliography();
JSONValue[] biblio_ordered;
@@ -1719,6 +1721,7 @@ template docAbstraction() {
obj_cite_digits,
opt_action,
);
+ // bookindex
destroy(bookindex_unordered_hashes);
auto the_document_bookindex_section = bi_tuple[0];
obj_cite_digits = bi_tuple[1];
@@ -1743,6 +1746,7 @@ template docAbstraction() {
comp_obj_heading_.metainfo.parent_lev_markup = 0;
the_document_blurb_section ~= comp_obj_heading_;
}
+ // blurb
debug(blurb) { foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } }
indent = [
"hang_position" : 1,
@@ -1760,6 +1764,7 @@ template docAbstraction() {
comp_obj_toc.attrib.indent_hang = indent["hang_position"];
comp_obj_toc.attrib.indent_base = indent["base_position"];
comp_obj_toc.attrib.bullet = false;
+ // use gathered
if (the_document_endnotes_section.length > 1) {
toc_txt_ = format("%s%s%s%s#%s%s",
mkup.lnk_o,
@@ -1836,8 +1841,10 @@ template docAbstraction() {
writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text);
}
}
+ // document head and body
the_document_head_section ~= the_document_body_section[0];
the_document_body_section = the_document_body_section[1..$];
+ // document ancestors
@safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) {
if (obj.metainfo.is_a == "heading") {
debug(dom) { writeln(obj.text); }
@@ -2025,6 +2032,7 @@ template docAbstraction() {
writeln("ancestors collapsed o_n: ", obj.metainfo.markedup_ancestors);
}
}
+ // segnames
if (the_document_endnotes_section.length > 1) {
segnames["html"] ~= "endnotes";
segnames["epub"] ~= "endnotes";
@@ -2100,6 +2108,7 @@ template docAbstraction() {
}
html_segnames_ptr_cntr++;
}
+ // decendants
@safe auto get_decendants()(ObjGenericComposite[] document_sections) {
int[string] _heading_ocn_decendants;
string[] _ocn_open_key = ["","","","","","","",""];
@@ -2147,6 +2156,7 @@ template docAbstraction() {
}
return pairs.sort;
}
+ // images
string[] _images;
@safe string[] extract_images()(string content_block) {
string[] images_;
@@ -2193,6 +2203,7 @@ template docAbstraction() {
}
return obj;
}
+ // links
@safe auto _links(O)(O obj) {
if (auto m = obj.text.match(rgx.inline_link_stow_uri)) {
debug(links) {
@@ -2212,6 +2223,7 @@ template docAbstraction() {
}
return obj;
}
+ // document head
foreach (ref obj; the_document_head_section) {
if (obj.metainfo.is_a == "heading") {
debug(dom) { writeln(obj.text); }
@@ -2300,7 +2312,7 @@ template docAbstraction() {
}
}
auto image_list = (_images.sort()).uniq;
- // optional only one 1~ level
+ // endnotes optional only one 1~ level
if (the_document_endnotes_section.length > 1) {
dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup;
dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup;
@@ -2335,7 +2347,7 @@ template docAbstraction() {
obj = _links(obj);
}
}
- // optional only one 1~ level
+ // glossary optional only one 1~ level
if (the_document_glossary_section.length > 1) {
foreach (ref obj; the_document_glossary_section) {
if (obj.metainfo.is_a == "heading") {
@@ -2370,7 +2382,7 @@ template docAbstraction() {
obj = _links(obj);
}
}
- // optional only one 1~ level
+ // bibliography optional only one 1~ level
if (the_document_bibliography_section.length > 1) {
foreach (ref obj; the_document_bibliography_section) {
if (obj.metainfo.is_a == "heading") {
@@ -2405,7 +2417,7 @@ template docAbstraction() {
obj = _links(obj);
}
}
- // optional only one 1~ level
+ // book index, optional only one 1~ level
int ocn_ = obj_cite_digits.object_number;
int ocn_bkidx_ = 0;
int ocn_bidx_;
@@ -2451,7 +2463,7 @@ template docAbstraction() {
// TODO assert failure, reinstate
// assert(obj_cite_digit_bkidx == ocn_bidx_ obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?");
}
- // optional only one 1~ level
+ // blurb optional only one 1~ level
if (the_document_blurb_section.length > 1) {
foreach (ref obj; the_document_blurb_section) {
if (obj.metainfo.is_a == "heading") {
@@ -2486,6 +2498,7 @@ template docAbstraction() {
obj = _links(obj);
}
}
+ // get decendants
if (the_document_body_section.length > 1) {
auto pairs = get_decendants(
the_document_head_section ~
@@ -2620,6 +2633,7 @@ template docAbstraction() {
comp_obj_heading_ = comp_obj_heading_.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, 0);
comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt);
// the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later
+ // the doc
ObjGenericComposite[][string] document_the = [
"head": the_document_head_section,
"toc": the_document_toc_section,
@@ -2634,6 +2648,7 @@ template docAbstraction() {
// dom tail only
"tail": the_document_xml_dom_tail_section,
];
+ // document parts keys as needed
string[][string] document_section_keys_sequenced = [
"scroll": ["head", "toc", "body",],
"seg": ["head", "toc", "body",],
@@ -2676,12 +2691,14 @@ template docAbstraction() {
document_section_keys_sequenced["scroll"] ~= "tail";
document_section_keys_sequenced["seg"] ~= "tail";
}
+ // segnames
string[] segnames_4 = segnames["html"].dup;
string[] segnames_lv1to4 = segnames["epub"].dup;
debug(segnames) {
writeln("segnames_lv4: ", segnames_4);
writeln("segnames_lv1to4: ", segnames_lv1to4);
}
+ // restart
destroy(the_document_head_section);
destroy(the_document_toc_section);
destroy(the_document_body_section);
@@ -2706,6 +2723,7 @@ template docAbstraction() {
dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0,];
lev_anchor_tag = "";
anchor_tag = "";
+ // identify parts
struct DocHas_ {
uint inline_links() {
return dochas["inline_links"];
@@ -2756,6 +2774,7 @@ template docAbstraction() {
@safe auto doc_has() {
return DocHas_();
}
+ // the doc to be returned
struct ST_docAbstraction {
ObjGenericComposite[][string] document_the;
DocHas_ doc_has;