From bbe133420aacf1ed7fc9a88702580be1782a1639 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 22 Oct 2020 10:57:37 -0400 Subject: org mode, code-block names --- org/metaverse.org | 4658 +++++++++++++++++++++++++++-------------------------- 1 file changed, 2332 insertions(+), 2326 deletions(-) (limited to 'org/metaverse.org') diff --git a/org/metaverse.org b/org/metaverse.org index 668ac15..cec377e 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -69,77 +69,77 @@ template docAbstraction() { } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object +/ /+ (includes regular text paragraph, headings & blocks other than code) +/ /+ heading, glossary, blurb, poem, group, block, quote, table +/ - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> } else { /+ not within a block group +/ <> if (line.matchFirst(rgx.block_open)) { <> } else if (!line.empty) { /+ line not empty +/ /+ non blocks (headings, paragraphs) & closed blocks +/ - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> } else if (pith["block_state"] == eN.blk_state.closing) { /+ line empty, with blocks flag +/ <> } else { /+ line.empty, post contents, empty variables: +/ - <> - <> - <> + <> + <> + <> } // close else for line empty } // close else for not the above } // close after non code, other blocks or regular text - <> + <> } /+ ← srcDocLoop closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> <> /+ post loop markup document/text ↑ +/ @@ -148,117 +148,117 @@ template docAbstraction() { <> <> <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> <> <> <> <> <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> /+ abstraction functions ↑ +/ /+ ↓ abstraction function emitters +/ <> /+ +/ - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> /+ +/ <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> <> /+ +/ - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> /+ +/ - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> /+ +/ - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> /+ +/ - <> - <> - <> - <> + <> + <> + <> + <> /+ abstraction functions emitters ↑ +/ /+ ↓ abstraction functions assertions +/ <> @@ -923,7 +923,7 @@ continue; **** _non code objects_ (non-code blocks & regular text: by line) [+4] :non_code: ***** inline fontface markup -#+NAME: abs_in_loop_body_non_code_obj_0 +#+NAME: abs_in_loop_body_non_code_obj_fontface_markup #+BEGIN_SRC d line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic #+END_SRC @@ -931,7 +931,7 @@ line = line.inline_markup_faces; // by text line (rather than by text object), l ***** in section (biblio, glossary, blurb) +(block group)+ [+1] :block:active: ****** in section: biblio :biblio: -#+NAME: abs_in_loop_body_non_code_obj_1 +#+NAME: abs_in_loop_body_non_code_obj_in_biblio #+BEGIN_SRC d if (line.matchFirst(rgx.heading_biblio) || (pith["section"] == eN.sect.bibliography @@ -960,7 +960,7 @@ if there is a glossary section you need to: - need indentation and regular paragraph inline markup - reconstitute the document with the glossary section following the endnotes -#+NAME: abs_in_loop_body_non_code_obj_2 +#+NAME: abs_in_loop_body_non_code_obj_in_glossary #+BEGIN_SRC d } else if (line.matchFirst(rgx.heading_glossary) || (pith["section"] == eN.sect.glossary @@ -1068,7 +1068,7 @@ if there is a blurb section you need to: - need regular paragraph inline markup - reconstitute the document with the blurb section at the very end of the doucment -#+NAME: abs_in_loop_body_non_code_obj_3 +#+NAME: abs_in_loop_body_non_code_obj_in_blurb #+BEGIN_SRC d } else if (line.matchFirst(rgx.heading_blurb) || (pith["section"] == eN.sect.blurb @@ -1221,69 +1221,69 @@ if there is a blurb section you need to: ***** in blocks [+1] :block:active: -#+NAME: abs_in_loop_body_non_code_obj_4 +#+NAME: abs_in_loop_body_non_code_obj_in_block #+BEGIN_SRC d } else if (pith["block_state"] == eN.blk_state.on) { #+END_SRC ****** in block: quote :quote: -#+NAME: abs_in_loop_body_non_code_obj_5 +#+NAME: abs_in_loop_body_non_code_obj_in_block_quote #+BEGIN_SRC d - if (pith["block_is"] == eN.blk_is.quote) { - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - an_object = line.flow_txt_block_quote(an_object, pith); - continue; +if (pith["block_is"] == eN.blk_is.quote) { + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + an_object = line.flow_txt_block_quote(an_object, pith); + continue; #+END_SRC ****** in block: group :group: -#+NAME: abs_in_loop_body_non_code_obj_6 +#+NAME: abs_in_loop_body_non_code_obj_in_block_group #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.group) { - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta) - .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); - an_object = line.flow_txt_block_group(an_object, pith); - continue; +} else if (pith["block_is"] == eN.blk_is.group) { + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta) + .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); + an_object = line.flow_txt_block_group(an_object, pith); + continue; #+END_SRC ****** in block: block :block: -#+NAME: abs_in_loop_body_non_code_obj_7 +#+NAME: abs_in_loop_body_non_code_obj_in_block_block #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.block) { +} else if (pith["block_is"] == eN.blk_is.block) { + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + if (auto m = line.match(rgx.spaces_keep)) { line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - if (auto m = line.match(rgx.spaces_keep)) { - line = line - .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); - } - an_object = line.flow_txt_block_block(an_object, pith); - continue; + .replaceAll(rgx.spaces_keep, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + } + an_object = line.flow_txt_block_block(an_object, pith); + continue; #+END_SRC ****** in block: poem :poem: -#+NAME: abs_in_loop_body_non_code_obj_8 +#+NAME: abs_in_loop_body_non_code_obj_in_block_poem #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.poem) { - an_object = line.flow_txt_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); - continue; +} else if (pith["block_is"] == eN.blk_is.poem) { + an_object = line.flow_txt_block_poem(an_object, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg); + continue; #+END_SRC ****** in block: table :table: -#+NAME: abs_in_loop_body_non_code_obj_9 +#+NAME: abs_in_loop_body_non_code_obj_in_block_table #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.table) { - an_object = line.flow_txt_block_table(an_object, pith, conf_make_meta); - continue; - } +} else if (pith["block_is"] == eN.blk_is.table) { + an_object = line.flow_txt_block_table(an_object, pith, conf_make_meta); + continue; +} #+END_SRC ***** not identified as being within block group (could still be, or not) [+3] @@ -1314,7 +1314,7 @@ continue; ****** line not empty [+2] ******* asserts :assert: -#+NAME: abs_in_loop_body_not_block_obj_0 +#+NAME: abs_in_loop_body_not_block_obj_assert #+BEGIN_SRC d assert( !line.empty, @@ -1342,7 +1342,7 @@ if (pith["block_state"] == eN.blk_state.closing) { ******* book index :bookindex: -#+NAME: abs_in_loop_body_not_block_obj_1 +#+NAME: abs_in_loop_body_not_block_obj_bookindex #+BEGIN_SRC d if (line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) @@ -1352,104 +1352,110 @@ if (line.matchFirst(rgx.book_index_item) ******* not book index [+1] -#+NAME: abs_in_loop_body_not_block_obj_2 +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex #+BEGIN_SRC d } else { /+ not book_index +/ #+END_SRC ******** matched: comment :comment:match: -#+NAME: abs_in_loop_body_not_block_obj_3 +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex_a_comment #+BEGIN_SRC d - an_object_key = "body_nugget"; - if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ - debug(comment) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; - comp_obj_comment = comp_obj_comment.init; - comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow - comp_obj_comment.metainfo.is_of_section = "comment"; // breaks flow - comp_obj_comment.metainfo.is_of_type = "comment"; - comp_obj_comment.metainfo.is_a = "comment"; - comp_obj_comment.text = an_object[an_object_key].strip; - the_document_body_section ~= comp_obj_comment; - flow_common_reset_(line_occur, an_object, pith); - processing.remove("verse"); - ++cntr; +an_object_key = "body_nugget"; +if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ + debug(comment) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; + comp_obj_comment = comp_obj_comment.init; + comp_obj_comment.metainfo.is_of_part = "comment"; // breaks flow + comp_obj_comment.metainfo.is_of_section = "comment"; // breaks flow + comp_obj_comment.metainfo.is_of_type = "comment"; + comp_obj_comment.metainfo.is_a = "comment"; + comp_obj_comment.text = an_object[an_object_key].strip; + the_document_body_section ~= comp_obj_comment; + flow_common_reset_(line_occur, an_object, pith); + processing.remove("verse"); + ++cntr; #+END_SRC ******** flag !set & line !exist: heading or para :heading:paragraph: -#+NAME: abs_in_loop_body_not_block_obj_4 +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex_a_para_type #+BEGIN_SRC d - } else if ((line_occur["para"] == eN.bi.off +} else if ((line_occur["para"] == eN.bi.off + && line_occur["heading"] == eN.bi.off) + && pith["txt_is"] == eN.txt_is.off +) { /+ heading or para but neither flag nor line exists +/ + if ((conf_make_meta.make.headings.length > 2) + && (pith["make_headings"] == eN.bi.off)) { /+ heading found +/ + heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); + } + if (pith["make_headings"] == eN.bi.on + && (line_occur["para"] == eN.bi.off && line_occur["heading"] == eN.bi.off) && pith["txt_is"] == eN.txt_is.off - ) { /+ heading or para but neither flag nor line exists +/ - if ((conf_make_meta.make.headings.length > 2) - && (pith["make_headings"] == eN.bi.off)) { /+ heading found +/ - heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, pith); - } - if (pith["make_headings"] == eN.bi.on - && (line_occur["para"] == eN.bi.off - && line_occur["heading"] == eN.bi.off) - && pith["txt_is"] == eN.txt_is.off - ) { /+ heading make set +/ - line = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); - } - /+ TODO node info: all headings identified at this point, - - extract node info here?? - - how long can it wait? - - should be incorporated in composite objects - - should happen before endnote links set (they need to be moved down?) - +/ - if (line.matchFirst(rgx.headings)) { /+ heading match +/ - line = line._doc_header_and_make_substitutions_(conf_make_meta); - an_object = line.flow_heading_matched_( - an_object, - line_occur, - an_object_key, - lv, - collapsed_lev, - pith, - conf_make_meta, - ); - } else if (line_occur["para"] == eN.bi.off) { /+ para match +/ - an_object_key = "body_nugget"; - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); - } + ) { /+ heading make set +/ + line = line.flow_heading_make_set_(line_occur, heading_match_rgx, pith); + } + /+ TODO node info: all headings identified at this point, + - extract node info here?? + - how long can it wait? + - should be incorporated in composite objects + - should happen before endnote links set (they need to be moved down?) + +/ + if (line.matchFirst(rgx.headings)) { /+ heading match +/ + line = line._doc_header_and_make_substitutions_(conf_make_meta); + an_object = line.flow_heading_matched_( + an_object, + line_occur, + an_object_key, + lv, + collapsed_lev, + pith, + conf_make_meta, + ); + } else if (line_occur["para"] == eN.bi.off) { /+ para match +/ + an_object_key = "body_nugget"; + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); + } #+END_SRC ******** line exist: heading :heading: -#+NAME: abs_in_loop_body_not_block_obj_5 +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex_a_heading #+BEGIN_SRC d - } else if (line_occur["heading"] > eN.bi.off) { /+ heading +/ - debug(heading) { - writeln(line); - } - an_object[an_object_key] ~= line ~= "\n"; - ++line_occur["heading"]; +} else if (line_occur["heading"] > eN.bi.off) { /+ heading +/ + debug(heading) { + writeln(line); + } + an_object[an_object_key] ~= line ~= "\n"; + ++line_occur["heading"]; #+END_SRC ******** line exist: para :para: -#+NAME: abs_in_loop_body_not_block_obj_6 +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex_a_para #+BEGIN_SRC d - } else if (line_occur["para"] > eN.bi.off) { /+ paragraph +/ - debug(para) { - writeln(an_object_key, "-> ", line); - } - line = line - ._doc_header_and_make_substitutions_(conf_make_meta) - ._doc_header_and_make_substitutions_fontface_(conf_make_meta); - an_object[an_object_key] ~= " " ~ line; - ++line_occur["para"]; +} else if (line_occur["para"] > eN.bi.off) { /+ paragraph +/ + debug(para) { + writeln(an_object_key, "-> ", line); } + line = line + ._doc_header_and_make_substitutions_(conf_make_meta) + ._doc_header_and_make_substitutions_fontface_(conf_make_meta); + an_object[an_object_key] ~= " " ~ line; + ++line_occur["para"]; +} +#+END_SRC + +******** not book index close + +#+NAME: abs_in_loop_body_not_block_obj_not_bookindex_close +#+BEGIN_SRC d } #+END_SRC @@ -1475,7 +1481,7 @@ an_object = line.flow_block_flag_line_empty_( ****** line empty [+1] ******* assert line empty :assert: -#+NAME: abs_in_loop_body_not_block_obj_line_empty_0 +#+NAME: abs_in_loop_body_not_block_obj_line_empty_assert #+BEGIN_SRC d assert( line.empty, @@ -1490,7 +1496,7 @@ assert( ******* heading object :heading:object: -#+NAME: abs_in_loop_body_not_block_obj_line_empty_1 +#+NAME: abs_in_loop_body_not_block_obj_line_empty_heading_obj #+BEGIN_SRC d if (_new_doc) { tag_assoc = tag_assoc.init; @@ -1624,7 +1630,7 @@ if (pith["txt_is"] == eN.txt_is.heading ******* paragraph object :paragraph:object: -#+NAME: abs_in_loop_body_not_block_obj_line_empty_2 +#+NAME: abs_in_loop_body_not_block_obj_line_empty_para_obj #+BEGIN_SRC d } else if (pith["txt_is"] == eN.txt_is.para && line_occur["para"] > eN.bi.off @@ -1693,7 +1699,7 @@ if (pith["txt_is"] == eN.txt_is.heading *** regular _text objects_ identified :text:paragraph: -#+NAME: abs_in_loop_body_01 +#+NAME: abs_in_loop_body_reloop_get_prior_state #+BEGIN_SRC d /+ unless (the_document_body_section.length == 0) ? +/ if (the_document_body_section.length > 0) { @@ -1755,7 +1761,7 @@ if (the_document_body_section.length > 0) { *** tie up preparation of document sections **** endnotes section (scroll & seg) :endnotes: -#+NAME: abs_post_0 +#+NAME: abs_post_endnote_tuple #+BEGIN_SRC d auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); @@ -1775,7 +1781,7 @@ debug(endnotes) { **** no glossary section? :glossary: -#+NAME: abs_post_1 +#+NAME: abs_post_glossary_nugget #+BEGIN_SRC d if (an_object["glossary_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; @@ -1804,7 +1810,7 @@ debug(glossary) { **** bibliography section (objects) :bibliography: -#+NAME: abs_post_2 +#+NAME: abs_post_biblio_init #+BEGIN_SRC d auto biblio_unsorted_incomplete = biblio_arr_json.dup; auto biblio = Bibliography(); @@ -1812,7 +1818,7 @@ auto biblio_ordered = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json); #+END_SRC -#+NAME: abs_post_3 +#+NAME: abs_post_biblio #+BEGIN_SRC d if (biblio_ordered.length > 0) { { @@ -1920,7 +1926,7 @@ if (biblio_ordered.length > 0) { } #+END_SRC -#+NAME: abs_post_4 +#+NAME: abs_post_biblio_debug_write #+BEGIN_SRC d debug(bibliosection) { foreach (o; the_bibliography_section) { @@ -1965,7 +1971,7 @@ JSONValue biblio_entry_tags_jsonstr = `{ **** bookindex section (scroll & seg) :book:index: -#+NAME: abs_post_5 +#+NAME: abs_post_bookindex #+BEGIN_SRC d auto bi = BookIndexReportSection(); auto bi_tuple @@ -1986,7 +1992,7 @@ debug(bookindex) { **** no blurb section? :blurb: -#+NAME: abs_post_6 +#+NAME: abs_post_no_blurb #+BEGIN_SRC d if (an_object["blurb_nugget"].length == 0) { comp_obj_heading_ = comp_obj_heading_.init; @@ -2017,7 +2023,7 @@ debug(blurb) { **** toc backmatter, table of contents backmatter (scroll & seg) :contents: -#+NAME: abs_post_7 +#+NAME: abs_post_contents #+BEGIN_SRC d indent = [ "hang_position" : 1, @@ -2118,7 +2124,7 @@ debug(toc) { **** doc head (separate document head from body, make space for toc) -#+NAME: abs_post_8 +#+NAME: abs_post_separate_doc_head_and_doc_body #+BEGIN_SRC d the_document_head_section ~= the_document_body_section[0]; the_document_body_section = the_document_body_section[1..$]; @@ -2142,7 +2148,7 @@ NOTE there are issues attempting to do this on first pass as: ***** Methods ****** get ancestors markup -#+NAME: abs_post_9 +#+NAME: abs_post_heading_ancestors_markup #+BEGIN_SRC d @safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { if (obj.metainfo.is_a == "heading") { @@ -2235,7 +2241,7 @@ NOTE there are issues attempting to do this on first pass as: ****** get ancestors collapsed -#+NAME: abs_post_10 +#+NAME: abs_post_heading_ancestors_collapsed #+BEGIN_SRC d @safe int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { if (obj.metainfo.is_a == "heading") { @@ -2328,7 +2334,7 @@ NOTE there are issues attempting to do this on first pass as: - substantive object numbers already exist - number un-numbered non-substantive text -#+NAME: abs_post_11 +#+NAME: abs_post_loop_section_body_get_ancestors #+BEGIN_SRC d /+ multiple 1~ levels, loop through document body +/ if (the_document_body_section.length > 1) { @@ -2356,7 +2362,7 @@ if (the_document_body_section.length > 1) { ***** ↻ Loop section: endnotes [en] -#+NAME: abs_post_12 +#+NAME: abs_post_loop_section_endnotes #+BEGIN_SRC d if (the_endnotes_section.length > 1) { segnames["html"] ~= "endnotes"; @@ -2377,7 +2383,7 @@ if (the_endnotes_section.length > 1) { ***** ↻ Loop section: glossary [gl] -#+NAME: abs_post_13 +#+NAME: abs_post_loop_section_glossary #+BEGIN_SRC d if (the_glossary_section.length > 1) { segnames["html"] ~= "glossary"; @@ -2398,7 +2404,7 @@ if (the_glossary_section.length > 1) { ***** ↻ Loop section: bibliography [bb] -#+NAME: abs_post_14 +#+NAME: abs_post_loop_section_biblio #+BEGIN_SRC d if (the_bibliography_section.length > 1) { segnames["html"] ~= "bibliography"; @@ -2419,7 +2425,7 @@ if (the_bibliography_section.length > 1) { ***** ↻ Loop section: book index [bi] -#+NAME: abs_post_15 +#+NAME: abs_post_loop_section_bookindex #+BEGIN_SRC d if (the_bookindex_section.length > 1) { segnames["html"] ~= "bookindex"; @@ -2440,7 +2446,7 @@ if (the_bookindex_section.length > 1) { ***** ↻ Loop section: blurb [bl] -#+NAME: abs_post_16 +#+NAME: abs_post_loop_section_blurb #+BEGIN_SRC d if (the_blurb_section.length > 1) { segnames["html"] ~= "blurb"; @@ -2500,7 +2506,7 @@ Build here: ***** Methods ****** decendants -#+NAME: abs_post_17 +#+NAME: abs_post_loop_all_obj_get_heading_decendants #+BEGIN_SRC d @safe auto get_decendants()(ObjGenericComposite[] document_sections) { int[string] _heading_ocn_decendants; @@ -2553,7 +2559,7 @@ Build here: ****** images: extract -#+NAME: abs_post_18 +#+NAME: abs_post_loop_all_obj_get_image_names #+BEGIN_SRC d string[] _images; @safe string[] extract_images()(string content_block) { @@ -2568,7 +2574,7 @@ string[] segnames_0_to_4; ****** images: dimensions -#+NAME: abs_post_19 +#+NAME: abs_post_loop_all_obj_get_image_dimensions #+BEGIN_SRC d @system auto _image_dimensions(O,M)(O obj, M manifested) { if (obj.has.image_without_dimensions) { @@ -2621,7 +2627,7 @@ string[] segnames_0_to_4; - book index - footnotes and footnote numbers -#+NAME: abs_post_20 +#+NAME: abs_post_loop_all_obj_get_links #+BEGIN_SRC d @safe auto _links(O)(O obj) { if (auto m = obj.text.match(rgx.inline_link_stow_uri)) { @@ -2646,7 +2652,7 @@ string[] segnames_0_to_4; ***** ↻ Loop section: head -#+NAME: abs_post_21 +#+NAME: abs_post_loop_section_head #+BEGIN_SRC d foreach (ref obj; the_document_head_section) { if (obj.metainfo.is_a == "heading") { @@ -2678,7 +2684,7 @@ foreach (ref obj; the_document_head_section) { ***** ↻ Loop section: toc [to] -#+NAME: abs_post_22 +#+NAME: abs_post_loop_section_toc #+BEGIN_SRC d if (the_table_of_contents_section.length > 1) { /+ scroll +/ @@ -2708,7 +2714,7 @@ if (the_table_of_contents_section.length > 1) { ***** ↻ Loop section: document body [bd] -#+NAME: abs_post_23 +#+NAME: abs_post_reloop_section_body #+BEGIN_SRC d /+ multiple 1~ levels, loop through document body +/ if (the_document_body_section.length > 1) { @@ -2759,7 +2765,7 @@ auto image_list = (_images.sort()).uniq; - endnotes have their own number, (also use in node) and they belong to calling object -#+NAME: abs_post_24 +#+NAME: abs_post_reloop_section_endnotes #+BEGIN_SRC d /+ optional only one 1~ level +/ if (the_endnotes_section.length > 1) { @@ -2800,11 +2806,11 @@ if (the_endnotes_section.length > 1) { } #+END_SRC -***** ↻ Loop section: glossary [gl] +***** ↻ reLoop section: glossary [gl] - add glossary numbering, (also use in node) no need to show in text -#+NAME: abs_post_25 +#+NAME: abs_post_reloop_section_glossary_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ if (the_glossary_section.length > 1) { @@ -2845,11 +2851,11 @@ if (the_glossary_section.length > 1) { } #+END_SRC -***** ↻ Loop section: bibliography [bb] +***** ↻ reLoop section: bibliography [bb] - add bibliography numbering, (also use in node) no need to show in text -#+NAME: abs_post_26 +#+NAME: abs_post_reloop_section_biblio_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ if (the_bibliography_section.length > 1) { @@ -2894,7 +2900,7 @@ if (the_bibliography_section.length > 1) { - add book index numbering?, (also use in node) no need to show in text -#+NAME: abs_post_27 +#+NAME: abs_post_reloop_section_bookindex_get_index #+BEGIN_SRC d /+ optional only one 1~ level +/ int ocn_ = obj_cite_digits.object_number; @@ -2949,7 +2955,7 @@ if (the_bookindex_section.length > 1) { / ***** ↻ Loop section: blurb [bl] -#+NAME: abs_post_28 +#+NAME: abs_post_reloop_section_blurb_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ if (the_blurb_section.length > 1) { @@ -2990,9 +2996,9 @@ if (the_blurb_section.length > 1) { } #+END_SRC -***** ↻ Loop sections: get decendants +***** ↻ reLoop sections: get decendants -#+NAME: abs_post_29 +#+NAME: abs_post_reloop_section_all_get_decendants #+BEGIN_SRC d if (the_document_body_section.length > 1) { auto pairs = get_decendants( @@ -3090,7 +3096,7 @@ if (the_document_body_section.length > 1) { **** TODO update BUG? -#+NAME: abs_post_30 +#+NAME: abs_post_heading_obj_reinitialize #+BEGIN_SRC d /+ TODO - note create/insert heading object sole purpose eof close all open tags @@ -3128,7 +3134,7 @@ comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); ** 4. _return document tuple_ :post: *** _the document_ :document: -#+NAME: abs_post_31 +#+NAME: abs_post_the_document #+BEGIN_SRC d ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, @@ -3148,7 +3154,7 @@ ObjGenericComposite[][string] document_the = [ *** document _section keys_ sequence -#+NAME: abs_post_32 +#+NAME: abs_post_document_parts_keys #+BEGIN_SRC d string[][string] document_section_keys_sequenced = [ "scroll": ["head", "toc", "body",], @@ -3196,7 +3202,7 @@ if ((opt_action.html) *** dup -#+NAME: abs_post_33 +#+NAME: abs_post_document_segnames #+BEGIN_SRC d string[] segnames_4 = segnames["html"].dup; string[] segnames_lv1_to_4 = segnames["epub"].dup; @@ -3208,7 +3214,7 @@ debug(segnames) { *** clean out structure -#+NAME: abs_post_34 +#+NAME: abs_post_document_reinitialize #+BEGIN_SRC d destroy(the_document_head_section); destroy(the_table_of_contents_section); @@ -3398,7 +3404,7 @@ functions used in document abstraction *** make substitutions **** project -#+NAME: abs_functions_substitutions_0 +#+NAME: abs_functions_substitutions_user_requested #+BEGIN_SRC d @safe char[] _doc_header_and_make_substitutions_(CMM)( char[] line, @@ -3419,7 +3425,7 @@ functions used in document abstraction **** fontface -#+NAME: abs_functions_substitutions_1 +#+NAME: abs_functions_substitutions_fontface #+BEGIN_SRC d @safe char[] _doc_header_and_make_substitutions_fontface_(CMM)( char[] line, @@ -3452,7 +3458,7 @@ functions used in document abstraction **** block start (open) block :start: ***** { block starts function -#+NAME: abs_functions_block_0 +#+NAME: abs_functions_block_open #+BEGIN_SRC d @safe void flow_txt_block_start()( char[] line, @@ -3464,271 +3470,271 @@ functions used in document abstraction ****** block (various) curly open :curly: -#+NAME: abs_functions_block_1 +#+NAME: abs_functions_block_regex #+BEGIN_SRC d - static auto rgx = RgxI(); +static auto rgx = RgxI(); #+END_SRC ******* code -#+NAME: abs_functions_block_2 +#+NAME: abs_functions_block_curly_open_code #+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 : ""; - debug(codecurly) { // code (curly) open - writefln( - "* [code curly] %s", - line - ); - } - pith["block_is"] = eN.blk_is.code; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; +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 : ""; + debug(codecurly) { // code (curly) open + writefln( + "* [code curly] %s", + line + ); + } + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; #+END_SRC ******* poem -#+NAME: abs_functions_block_3 +#+NAME: abs_functions_block_curly_open_poem #+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 : ""; - debug(poem) { // poem (curly) open - writefln( - "* [poem curly] %s", - line - ); - } - object_number_poem["start"] = obj_cite_digits.object_number.to!string; - pith["block_is"] = eN.blk_is.poem; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; - pith["verse_new"] = eN.bi.on; +} 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 : ""; + debug(poem) { // poem (curly) open + writefln( + "* [poem curly] %s", + line + ); + } + object_number_poem["start"] = obj_cite_digits.object_number.to!string; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; + pith["verse_new"] = eN.bi.on; #+END_SRC ******* group -#+NAME: abs_functions_block_4 +#+NAME: abs_functions_block_curly_open_group #+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 : ""; - debug(group) { // group (curly) open - writefln( - "* [group curly] %s", - line - ); - } - pith["block_is"] = eN.blk_is.group; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; +} 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 : ""; + debug(group) { // group (curly) open + writefln( + "* [group curly] %s", + line + ); + } + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; #+END_SRC ******* block -#+NAME: abs_functions_block_5 +#+NAME: abs_functions_block_curly_open_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 : ""; - debug(block) { - writefln( - "* [block curly] %s", - line - ); - } - pith["block_is"] = eN.blk_is.block; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; +} 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 : ""; + debug(block) { + writefln( + "* [block curly] %s", + line + ); + } + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; #+END_SRC ******* quote -#+NAME: abs_functions_block_6 +#+NAME: abs_functions_block_curly_open_quote #+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; - debug(quote) { - writefln( - "* [quote curly] %s", - line - ); - } - pith["block_is"] = eN.blk_is.quote; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; +} 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; + debug(quote) { + writefln( + "* [quote curly] %s", + line + ); + } + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; #+END_SRC ******* table -#+NAME: abs_functions_block_7 +#+NAME: abs_functions_block_curly_open_table #+BEGIN_SRC d - } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ - debug(table) { // table (curly) open - writefln( - "* [table curly] %s", - line - ); - } - dochas["table"] ++; - an_object["table_head"] = m["attrib"].to!string; - an_object["block_type"] = "curly"; - pith["block_is"] = eN.blk_is.table; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly; +} else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ + debug(table) { // table (curly) open + writefln( + "* [table curly] %s", + line + ); + } + dochas["table"] ++; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "curly"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly; #+END_SRC ******* table special -#+NAME: abs_functions_block_8 +#+NAME: abs_functions_block_curly_open_table_special #+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"; - pith["block_is"] = eN.blk_is.table; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.curly_special; +} 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"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.curly_special; #+END_SRC ****** block (various) tic open :tic: ******* code -#+NAME: abs_functions_block_9 +#+NAME: abs_functions_block_tic_open_code #+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 : ""; - debug(codetic) { - writefln( - "* [code tic] %s", - line - ); - } - pith["block_is"] = eN.blk_is.code; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; +} 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 : ""; + debug(codetic) { + writefln( + "* [code tic] %s", + line + ); + } + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; #+END_SRC ******* poem -#+NAME: abs_functions_block_10 +#+NAME: abs_functions_block_tic_open_poem #+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 : ""; - debug(poem) { - writefln( - "* [poem tic] %s", - line - ); - } - object_number_poem["start"] = obj_cite_digits.object_number.to!string; - pith["block_is"] = eN.blk_is.poem; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; - pith["verse_new"] = eN.bi.on; +} 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 : ""; + debug(poem) { + writefln( + "* [poem tic] %s", + line + ); + } + object_number_poem["start"] = obj_cite_digits.object_number.to!string; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; + pith["verse_new"] = eN.bi.on; #+END_SRC ******* group -#+NAME: abs_functions_block_11 +#+NAME: abs_functions_block_tic_open_group #+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 : ""; - debug(group) { - writefln( - "* [group tic] %s", - line - ); - } - pith["block_is"] = eN.blk_is.group; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; +} 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 : ""; + debug(group) { + writefln( + "* [group tic] %s", + line + ); + } + pith["block_is"] = eN.blk_is.group; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; #+END_SRC ******* block -#+NAME: abs_functions_block_12 +#+NAME: abs_functions_block_tic_open_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 : ""; - debug(block) { - writefln( - "* [block tic] %s", - line - ); - } - pith["block_is"] = eN.blk_is.block; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; +} 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 : ""; + debug(block) { + writefln( + "* [block tic] %s", + line + ); + } + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; #+END_SRC ******* quote -#+NAME: abs_functions_block_13 +#+NAME: abs_functions_block_tic_open_quote #+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; - debug(quote) { // quote (tic) open - writefln( - "* [quote tic] %s", - line - ); - } - pith["block_is"] = eN.blk_is.quote; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; +} 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; + debug(quote) { // quote (tic) open + writefln( + "* [quote tic] %s", + line + ); + } + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; #+END_SRC ******* table -#+NAME: abs_functions_block_14 +#+NAME: abs_functions_block_tic_open_table #+BEGIN_SRC d - } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ - debug(table) { // table (tic) open - writefln( - "* [table tic] %s", - line - ); - } - dochas["table"] ++; - an_object["table_head"] = m["attrib"].to!string; - an_object["block_type"] = "tic"; - pith["block_is"] = eN.blk_is.table; - pith["block_state"] = eN.blk_state.on; - pith["block_delim"] = eN.blk_delim.tic; +} else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ + debug(table) { // table (tic) open + writefln( + "* [table tic] %s", + line + ); } + dochas["table"] ++; + an_object["table_head"] = m["attrib"].to!string; + an_object["block_type"] = "tic"; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.on; + pith["block_delim"] = eN.blk_delim.tic; +} #+END_SRC ***** } -#+NAME: abs_functions_block_15 +#+NAME: abs_functions_block_close #+BEGIN_SRC d } #+END_SRC @@ -3785,9 +3791,9 @@ functions used in document abstraction #+END_SRC ***** biblio block :biblio: -****** biblio tag map +****** biblio map tags -#+NAME: abs_functions_block_biblio_0 +#+NAME: abs_functions_block_biblio_map_tags #+BEGIN_SRC d @safe final string biblio_tag_map()(string abr) { auto btm = [ @@ -3839,7 +3845,7 @@ final string biblio_tag_map_()(string abr) { ****** biblio block -#+NAME: abs_functions_block_biblio_1 +#+NAME: abs_functions_block_biblio_text_block #+BEGIN_SRC d @system void flow_txt_block_biblio( char[] line, @@ -4453,7 +4459,7 @@ process and use an_object["table_head"] (then empty it) - table_column_widths, int[] column widths (as given or calculate average) - show table walls, bool -#+NAME: abs_functions_block_line_status_empty_0 +#+NAME: abs_functions_block_line_status_empty_table_closed #+BEGIN_SRC d @system void flow_table_closed_make_special_notation_table_(N,CMM)( char[] line, @@ -4502,7 +4508,7 @@ process and use an_object["table_head"] (then empty it) ***** { line empty, _make block_ -#+NAME: abs_functions_block_line_status_empty_1 +#+NAME: abs_functions_block_line_status_empty_block_close_function_open #+BEGIN_SRC d @system string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( char[] line, @@ -4528,337 +4534,337 @@ process and use an_object["table_head"] (then empty it) "code block status: closed" ); static auto rgx = RgxI(); + if (pith["block_state"] == eN.blk_state.closing) { #+END_SRC ****** make: quote block -#+NAME: abs_functions_block_line_status_empty_2 +#+NAME: abs_functions_block_line_status_empty_block_quote #+BEGIN_SRC d - if (pith["block_state"] == eN.blk_state.closing) { - if (pith["block_is"] == eN.blk_is.quote) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "quote"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "quote"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - pith["block_is"] = eN.blk_is.quote; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; +if (pith["block_is"] == eN.blk_is.quote) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "quote"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "quote"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + pith["block_is"] = eN.blk_is.quote; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; #+END_SRC ****** make: group block -#+NAME: abs_functions_block_line_status_empty_3 +#+NAME: abs_functions_block_line_status_empty_block_group #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.group) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "group"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "group"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - pith["block_is"] = eN.blk_is.poem; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; +} else if (pith["block_is"] == eN.blk_is.group) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "group"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "group"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; #+END_SRC ****** make: block -#+NAME: abs_functions_block_line_status_empty_4 +#+NAME: abs_functions_block_line_status_empty_block_block #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.block) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "block"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - comp_obj_block.metainfo.is_a = "block"; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; - comp_obj_block.metainfo.lang = an_object["lang"]; - comp_obj_block.metainfo.attrib = an_object["attrib"]; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.text = an_object["substantive"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - pith["block_is"] = eN.blk_is.block; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; +} else if (pith["block_is"] == eN.blk_is.block) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "block"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + comp_obj_block.metainfo.is_a = "block"; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; + comp_obj_block.metainfo.lang = an_object["lang"]; + comp_obj_block.metainfo.attrib = an_object["attrib"]; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.text = an_object["substantive"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + pith["block_is"] = eN.blk_is.block; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; #+END_SRC ****** make: poem -#+NAME: abs_functions_block_line_status_empty_5 +#+NAME: abs_functions_block_line_status_empty_block_poem #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.poem) { - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "verse"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - comp_obj_poem_ocn = comp_obj_poem_ocn.init; - comp_obj_poem_ocn.metainfo.is_of_part = "body"; - comp_obj_poem_ocn.metainfo.is_of_section = "body"; - comp_obj_poem_ocn.metainfo.is_of_type = "block"; - comp_obj_poem_ocn.metainfo.is_a = "poem"; - comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_poem_ocn.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_poem_ocn.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_poem_ocn.text = ""; - the_document_body_section ~= comp_obj_poem_ocn; - pith["block_is"] = eN.blk_is.poem; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); +} else if (pith["block_is"] == eN.blk_is.poem) { + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "verse"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + comp_obj_poem_ocn = comp_obj_poem_ocn.init; + comp_obj_poem_ocn.metainfo.is_of_part = "body"; + comp_obj_poem_ocn.metainfo.is_of_section = "body"; + comp_obj_poem_ocn.metainfo.is_of_type = "block"; + comp_obj_poem_ocn.metainfo.is_a = "poem"; + comp_obj_poem_ocn.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_poem_ocn.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_poem_ocn.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_poem_ocn.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_poem_ocn.text = ""; + the_document_body_section ~= comp_obj_poem_ocn; + pith["block_is"] = eN.blk_is.poem; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); #+END_SRC ****** make: code block -#+NAME: abs_functions_block_line_status_empty_6 +#+NAME: abs_functions_block_line_status_empty_block_code #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.code) { - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "code"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_code = comp_obj_code.init; - comp_obj_code.metainfo.is_of_part = "body"; - comp_obj_code.metainfo.is_of_section = "body"; - comp_obj_code.metainfo.is_of_type = "block"; - comp_obj_code.metainfo.is_a = "code"; - comp_obj_code.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_code.metainfo.syntax = an_object["syntax"]; - comp_obj_code.metainfo.attrib = an_object["attrib"]; - comp_obj_code.code_block.linenumbers = (an_object["attrib"].match(rgx.code_numbering)) ? true : false; - comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_code.text = an_object["substantive"]; - comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_code; - pith["block_is"] = eN.blk_is.code; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; -#+END_SRC - -****** make: table +} else if (pith["block_is"] == eN.blk_is.code) { + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "code"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_code = comp_obj_code.init; + comp_obj_code.metainfo.is_of_part = "body"; + comp_obj_code.metainfo.is_of_section = "body"; + comp_obj_code.metainfo.is_of_type = "block"; + comp_obj_code.metainfo.is_a = "code"; + comp_obj_code.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_code.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_code.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_code.metainfo.syntax = an_object["syntax"]; + comp_obj_code.metainfo.attrib = an_object["attrib"]; + comp_obj_code.code_block.linenumbers = (an_object["attrib"].match(rgx.code_numbering)) ? true : false; + comp_obj_code.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_code.text = an_object["substantive"]; + comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_code; + pith["block_is"] = eN.blk_is.code; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; +#+END_SRC + +****** make: table -#+NAME: abs_functions_block_line_status_empty_7 +#+NAME: abs_functions_block_line_status_empty_block_table #+BEGIN_SRC d - } else if (pith["block_is"] == eN.blk_is.table) { - comp_obj_block = comp_obj_block.init; - obj_cite_digits = ocn_emit(pith["ocn"]); - an_object["bookindex_nugget"] - = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; - bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash( - an_object["bookindex_nugget"], - obj_cite_digits, - tag_in_seg - ); - an_object["is"] = "table"; - auto comp_obj_location - = node_construct.node_location_emitter( - content_non_header, - tag_in_seg, - lev_anchor_tag, - tag_assoc, - obj_cite_digits, - cntr, - heading_ptr-1, - an_object["is"] - ); - TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple - = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; - comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; - comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; - comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]); - comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]); - the_document_body_section ~= comp_obj_block; - pith["block_is"] = eN.blk_is.table; - pith["block_state"] = eN.blk_state.off; - pith["block_delim"] = eN.blk_delim.off; - object_reset(an_object); - processing.remove("verse"); - ++cntr; - } +} else if (pith["block_is"] == eN.blk_is.table) { + comp_obj_block = comp_obj_block.init; + obj_cite_digits = ocn_emit(pith["ocn"]); + an_object["bookindex_nugget"] + = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; + bookindex_unordered_hashes + = bookindex_extract_hash.bookindex_nugget_hash( + an_object["bookindex_nugget"], + obj_cite_digits, + tag_in_seg + ); + an_object["is"] = "table"; + auto comp_obj_location + = node_construct.node_location_emitter( + content_non_header, + tag_in_seg, + lev_anchor_tag, + tag_assoc, + obj_cite_digits, + cntr, + heading_ptr-1, + an_object["is"] + ); + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple + = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_block.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_block.metainfo.object_number_off = obj_cite_digits.off; + comp_obj_block.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; + comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; + comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]); + comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]); + the_document_body_section ~= comp_obj_block; + pith["block_is"] = eN.blk_is.table; + pith["block_state"] = eN.blk_state.off; + pith["block_delim"] = eN.blk_delim.off; + object_reset(an_object); + processing.remove("verse"); + ++cntr; +} #+END_SRC ***** } -#+NAME: abs_functions_block_line_status_empty_8 +#+NAME: abs_functions_block_line_status_empty_block_close_function_close #+BEGIN_SRC d } return an_object; @@ -4924,7 +4930,7 @@ process and use an_object["table_head"] (then empty it) *** heading or paragraph :heading:paragraph: **** heading found :heading: -#+NAME: abs_functions_heading_0 +#+NAME: abs_functions_heading_found #+BEGIN_SRC d @safe string[string] flow_heading_found_()( char[] line, @@ -5011,7 +5017,7 @@ process and use an_object["table_head"] (then empty it) **** heading make set :heading: -#+NAME: abs_functions_heading_1 +#+NAME: abs_functions_heading_make_set #+BEGIN_SRC d @safe char[] flow_heading_make_set_()( char[] line, @@ -5073,7 +5079,7 @@ process and use an_object["table_head"] (then empty it) **** heading match :heading: -#+NAME: abs_functions_heading_2 +#+NAME: abs_functions_heading_matched #+BEGIN_SRC d @safe string[string] flow_heading_matched_(CMM)( char[] line, @@ -5229,7 +5235,7 @@ process and use an_object["table_head"] (then empty it) **** para match :para: -#+NAME: abs_functions_para_0 +#+NAME: abs_functions_para_matched #+BEGIN_SRC d @safe string[string] flow_para_match_()( char[] line, @@ -5288,7 +5294,7 @@ process and use an_object["table_head"] (then empty it) **** text font face -#+NAME: abs_functions_para_1 +#+NAME: abs_functions_para_font_faces_line #+BEGIN_SRC d @safe char[] font_faces_line()( char[] textline, @@ -5325,7 +5331,7 @@ process and use an_object["table_head"] (then empty it) ***** table instructions -#+NAME: abs_functions_table_0 +#+NAME: abs_functions_table_instructions #+BEGIN_SRC d @safe ObjGenericComposite flow_table_instructions(H)( return ref ObjGenericComposite table_object, @@ -5356,7 +5362,7 @@ process and use an_object["table_head"] (then empty it) ***** table array munge -#+NAME: abs_functions_table_1 +#+NAME: abs_functions_table_munge_array #+BEGIN_SRC d @safe ObjGenericComposite flow_table_array_munge(T)( return ref ObjGenericComposite table_object, @@ -5486,7 +5492,7 @@ process and use an_object["table_head"] (then empty it) ***** table substantive munge -#+NAME: abs_functions_table_2 +#+NAME: abs_functions_table_munge_substantive #+BEGIN_SRC d @system ObjGenericComposite flow_table_substantive_munge(T)( return ref ObjGenericComposite table_object, @@ -5508,7 +5514,7 @@ process and use an_object["table_head"] (then empty it) ***** table substantive munge special -#+NAME: abs_functions_table_3 +#+NAME: abs_functions_table_munge_substantive_special #+BEGIN_SRC d @system ObjGenericComposite flow_table_substantive_munge_special(T)( return ref ObjGenericComposite table_object, @@ -5588,7 +5594,7 @@ process and use an_object["table_head"] (then empty it) ****** { struct, inline markup munge -#+NAME: meta_emitters_obj_inline_markup_munge_0 +#+NAME: meta_emitters_obj_inline_markup_munge_function_open #+BEGIN_SRC d @safe static struct ObjInlineMarkupMunge { string[string] obj_txt; @@ -5606,211 +5612,211 @@ process and use an_object["table_head"] (then empty it) } #+END_SRC -#+NAME: meta_emitters_obj_inline_markup_munge_1 +#+NAME: meta_emitters_obj_inline_markup_munge_function_markup_images #+BEGIN_SRC d - @safe static auto images()(string obj_txt_in) { - static auto mng = InlineMarkup(); - /+ url matched +/ - obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented - if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ +@safe static auto images()(string obj_txt_in) { + static auto mng = InlineMarkup(); + /+ url matched +/ + obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented + if (obj_txt_in.match(rgx.smid_image_generic)) { /+ images with and without links +/ + debug(images) { + writeln("Image: ", obj_txt_in); + } + if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { + obj_txt_in = obj_txt_in + .replaceAll(rgx.smid_image_with_dimensions, ("$1" ~ mkup.img ~ "$2,w$3h$4 " ~ "$5")) + .replaceAll(rgx.smid_image_delimit, ("$1" + ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c + ~ mkup.url_o ~ mkup.url_c)); debug(images) { - writeln("Image: ", obj_txt_in); - } - if (obj_txt_in.match(rgx.smid_image_with_dimensions)) { - obj_txt_in = obj_txt_in - .replaceAll(rgx.smid_image_with_dimensions, ("$1" ~ mkup.img ~ "$2,w$3h$4 " ~ "$5")) - .replaceAll(rgx.smid_image_delimit, ("$1" - ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c - ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE with size: ", obj_txt_in); - } - } else if (obj_txt_in.match(rgx.smid_image)) { - obj_txt_in = obj_txt_in - .replaceAll(rgx.smid_image, ("$1" ~ mkup.img ~ "$2,w0h0" ~ "$3")) - .replaceAll(rgx.smid_image_delimit, ("$1" - ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c - ~ mkup.url_o ~ mkup.url_c)); - debug(images) { - writeln("IMAGE: ", obj_txt_in); // decide on representation - } + writeln("IMAGE with size: ", obj_txt_in); + } + } else if (obj_txt_in.match(rgx.smid_image)) { + obj_txt_in = obj_txt_in + .replaceAll(rgx.smid_image, ("$1" ~ mkup.img ~ "$2,w0h0" ~ "$3")) + .replaceAll(rgx.smid_image_delimit, ("$1" + ~ mkup.lnk_o ~ "$2".strip ~ mkup.lnk_c + ~ mkup.url_o ~ mkup.url_c)); + debug(images) { + writeln("IMAGE: ", obj_txt_in); // decide on representation } } - return obj_txt_in; } + return obj_txt_in; +} #+END_SRC ******* footnotes endnotes markup -#+NAME: meta_emitters_obj_inline_markup_munge_2 +#+NAME: meta_emitters_obj_inline_markup_munge_function_markup_footnotes_endnotes #+BEGIN_SRC d - @safe TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { - /+ endnotes (regular) +/ - bool flg_notes_reg = false; - bool flg_notes_star = false; - bool flg_notes_plus = false; - obj_txt_in = obj_txt_in.replaceAll( - rgx.inline_notes_curly, - (mkup.en_a_o ~ " $1" ~ mkup.en_a_c) - ); - if (!(stage_reset_note_numbers) && reset_note_numbers) { - stage_reset_note_numbers = true; - } - obj_txt_out = ""; - if (obj_txt_in.match(rgx.inline_notes_al_gen)) { - string[] _tmp_txt; - foreach (x; obj_txt_in.split("\n")) { - if (auto m = x.matchAll(rgx.inline_text_and_note_al_)) { - if (stage_reset_note_numbers) { - n_foot = 0; - n_foot_reg = 0; - n_foot_sp_asterisk = 0; - n_foot_sp_plus = 0; - } - stage_reset_note_numbers = false; - foreach(n; m) { - if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { - flg_notes_star = true; - ++n_foot_sp_asterisk; - asterisks_ = "*"; - n_foot = n_foot_sp_asterisk; - _tmp_txt ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_symbol_star, - (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") - ); - } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { - flg_notes_plus = true; - ++n_foot_sp_plus; - plus_ = "*"; - n_foot = n_foot_sp_plus; - _tmp_txt ~= n.hit.to!string.replaceFirst( - rgx.inline_al_delimiter_open_symbol_plus, - (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") - ); - } else if (n.hit.to!string.matchFirst(rgx.inline_al_delimiter_open_regular)) { - string _tmp_str = n.hit.to!string; - flg_notes_reg = true; - foreach (q; n.hit.to!string.matchAll(rgx.inline_al_delimiter_open_regular)) { - ++n_foot_reg; - n_foot = n_foot_reg; - _tmp_str = replaceFirst!(m => mkup.en_a_o ~ n_foot.to!string ~ " ") - (_tmp_str, rgx.inline_al_delimiter_open_regular); - } - _tmp_txt ~= _tmp_str; - } else { - _tmp_txt ~= n.hit.to!string; +@safe TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { + /+ endnotes (regular) +/ + bool flg_notes_reg = false; + bool flg_notes_star = false; + bool flg_notes_plus = false; + obj_txt_in = obj_txt_in.replaceAll( + rgx.inline_notes_curly, + (mkup.en_a_o ~ " $1" ~ mkup.en_a_c) + ); + if (!(stage_reset_note_numbers) && reset_note_numbers) { + stage_reset_note_numbers = true; + } + obj_txt_out = ""; + if (obj_txt_in.match(rgx.inline_notes_al_gen)) { + string[] _tmp_txt; + foreach (x; obj_txt_in.split("\n")) { + if (auto m = x.matchAll(rgx.inline_text_and_note_al_)) { + if (stage_reset_note_numbers) { + n_foot = 0; + n_foot_reg = 0; + n_foot_sp_asterisk = 0; + n_foot_sp_plus = 0; + } + stage_reset_note_numbers = false; + foreach(n; m) { + if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_star)) { + flg_notes_star = true; + ++n_foot_sp_asterisk; + asterisks_ = "*"; + n_foot = n_foot_sp_asterisk; + _tmp_txt ~= n.hit.to!string.replaceFirst( + rgx.inline_al_delimiter_open_symbol_star, + (mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ") + ); + } else if (n.hit.to!string.match(rgx.inline_al_delimiter_open_symbol_plus)) { + flg_notes_plus = true; + ++n_foot_sp_plus; + plus_ = "*"; + n_foot = n_foot_sp_plus; + _tmp_txt ~= n.hit.to!string.replaceFirst( + rgx.inline_al_delimiter_open_symbol_plus, + (mkup.en_a_o ~ replicate(plus_, n_foot_sp_plus) ~ " ") + ); + } else if (n.hit.to!string.matchFirst(rgx.inline_al_delimiter_open_regular)) { + string _tmp_str = n.hit.to!string; + flg_notes_reg = true; + foreach (q; n.hit.to!string.matchAll(rgx.inline_al_delimiter_open_regular)) { + ++n_foot_reg; + n_foot = n_foot_reg; + _tmp_str = replaceFirst!(m => mkup.en_a_o ~ n_foot.to!string ~ " ") + (_tmp_str, rgx.inline_al_delimiter_open_regular); } + _tmp_txt ~= _tmp_str; + } else { + _tmp_txt ~= n.hit.to!string; } - obj_txt_out = _tmp_txt.join("\n"); } + obj_txt_out = _tmp_txt.join("\n"); } - } else { - obj_txt_out = obj_txt_in; } - TxtPlusHasFootnotes t = tuple( - obj_txt_out, - flg_notes_reg, - flg_notes_star, - flg_notes_plus, - ); - return t; + } else { + obj_txt_out = obj_txt_in; } + TxtPlusHasFootnotes t = tuple( + obj_txt_out, + flg_notes_reg, + flg_notes_star, + flg_notes_plus, + ); + return t; +} #+END_SRC ******* object notes and links -#+NAME: meta_emitters_obj_inline_markup_munge_3 +#+NAME: meta_emitters_obj_inline_markup_munge_function_object_notes_and_links #+BEGIN_SRC d - @safe private TxtPlusHasFootnotesUrlsImages object_notes_and_links_()( - string obj_txt_in, - bool reset_note_numbers = false - ) { - obj_txt_out = ""; - bool urls = false; - bool images_without_dimensions = false; - tail = ""; - /+ special endnotes +/ - obj_txt_in = obj_txt_in.replaceAll( - rgx.inline_notes_curly_sp_asterisk, - (mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c) - ); - obj_txt_in - = obj_txt_in.replaceAll( - rgx.inline_notes_curly_sp_plus, - (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) - ); - /+ image matched +/ - if (obj_txt_in.match(rgx.smid_image_generic)) { - obj_txt_in = images(obj_txt_in); - if (obj_txt_in.match(rgx.smid_mod_image_without_dimensions)) { - images_without_dimensions = true; - } - } - /+ url matched +/ - if (obj_txt_in.match(rgx.smid_inline_url)) { - urls = true; - obj_txt_in = obj_txt_in.links_and_images; - } - if (auto m = obj_txt_in.match(rgx.para_inline_link_anchor)) { - obj_txt_in = obj_txt_in - .replaceAll(rgx.para_inline_link_anchor, "┃$1┃"); - } - TxtPlusHasFootnotes ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); - obj_txt_out = ftn.obj_txt; - debug(footnotes) { - writeln(obj_txt_out, tail); - } - obj_txt_out = obj_txt_out ~ tail; - debug(footnotesdone) { - foreach(m; matchAll(obj_txt_out, - (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { - writeln(m[1]); - writeln(m.hit); - } - } - TxtPlusHasFootnotesUrlsImages t = tuple( - obj_txt_out, - ftn.has_notes_reg, - ftn.has_notes_star, - ftn.has_notes_plus, - urls, - images_without_dimensions, +@safe private TxtPlusHasFootnotesUrlsImages object_notes_and_links_()( + string obj_txt_in, + bool reset_note_numbers = false +) { + obj_txt_out = ""; + bool urls = false; + bool images_without_dimensions = false; + tail = ""; + /+ special endnotes +/ + obj_txt_in = obj_txt_in.replaceAll( + rgx.inline_notes_curly_sp_asterisk, + (mkup.en_a_o ~ "*" ~ " $1" ~ mkup.en_a_c) + ); + obj_txt_in + = obj_txt_in.replaceAll( + rgx.inline_notes_curly_sp_plus, + (mkup.en_a_o ~ "+" ~ " $1" ~ mkup.en_a_c) ); - return t; - } - auto init() { - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(""); - return t; - } - invariant() { - } + /+ image matched +/ + if (obj_txt_in.match(rgx.smid_image_generic)) { + obj_txt_in = images(obj_txt_in); + if (obj_txt_in.match(rgx.smid_mod_image_without_dimensions)) { + images_without_dimensions = true; + } + } + /+ url matched +/ + if (obj_txt_in.match(rgx.smid_inline_url)) { + urls = true; + obj_txt_in = obj_txt_in.links_and_images; + } + if (auto m = obj_txt_in.match(rgx.para_inline_link_anchor)) { + obj_txt_in = obj_txt_in + .replaceAll(rgx.para_inline_link_anchor, "┃$1┃"); + } + TxtPlusHasFootnotes ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); + obj_txt_out = ftn.obj_txt; + debug(footnotes) { + writeln(obj_txt_out, tail); + } + obj_txt_out = obj_txt_out ~ tail; + debug(footnotesdone) { + foreach(m; matchAll(obj_txt_out, + (mkup.en_a_o ~ `\s*(.+?)` ~ mkup.en_a_c))) { + writeln(m[1]); + writeln(m.hit); + } + } + TxtPlusHasFootnotesUrlsImages t = tuple( + obj_txt_out, + ftn.has_notes_reg, + ftn.has_notes_star, + ftn.has_notes_plus, + urls, + images_without_dimensions, + ); + return t; +} +auto init() { + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(""); + return t; +} +invariant() { +} #+END_SRC ******* heading - identified text by heading level marker followed by text until two new lines - general markup -#+NAME: meta_emitters_obj_inline_markup_munge_4 +#+NAME: meta_emitters_obj_inline_markup_munge_function_heading #+BEGIN_SRC d - @safe auto munge_heading()( - string obj_txt_in, - bool reset_note_numbers = false - ) { - obj_txt["munge"] = obj_txt_in - .replaceFirst(rgx.headings, "") - .replaceFirst(rgx.object_number_off_all, "") - .strip; - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); - debug(munge) { - writeln(__LINE__); - writeln(obj_txt_in); - writeln(__LINE__); - writeln(obj_txt["munge"].to!string); - } - return t; - } - invariant() { +@safe auto munge_heading()( + string obj_txt_in, + bool reset_note_numbers = false +) { + obj_txt["munge"] = obj_txt_in + .replaceFirst(rgx.headings, "") + .replaceFirst(rgx.object_number_off_all, "") + .strip; + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); + debug(munge) { + writeln(__LINE__); + writeln(obj_txt_in); + writeln(__LINE__); + writeln(obj_txt["munge"].to!string); } + return t; +} +invariant() { +} #+END_SRC ******* para @@ -5821,33 +5827,33 @@ process and use an_object["table_head"] (then empty it) - footnotes/endnotes - links -#+NAME: meta_emitters_obj_inline_markup_munge_5 +#+NAME: meta_emitters_obj_inline_markup_munge_function_para #+BEGIN_SRC d - @safe auto munge_para()(string obj_txt_in) { - obj_txt["munge"] = (obj_txt_in) - .replaceFirst(rgx.para_attribs, "") - .replaceFirst(rgx.object_number_off_all, ""); - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); - debug(munge) { - writeln(__LINE__); - writeln(obj_txt_in); - writeln(__LINE__); - writeln(obj_txt["munge"].to!string); - } - return t; +@safe auto munge_para()(string obj_txt_in) { + obj_txt["munge"] = (obj_txt_in) + .replaceFirst(rgx.para_attribs, "") + .replaceFirst(rgx.object_number_off_all, ""); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); + debug(munge) { + writeln(__LINE__); + writeln(obj_txt_in); + writeln(__LINE__); + writeln(obj_txt["munge"].to!string); } + return t; +} #+END_SRC ******* quote -#+NAME: meta_emitters_obj_inline_markup_munge_6 +#+NAME: meta_emitters_obj_inline_markup_munge_function_quote #+BEGIN_SRC d - @safe string munge_quote()(string obj_txt_in) { - obj_txt["munge"] = obj_txt_in; - return obj_txt["munge"]; - } - invariant() { - } +@safe string munge_quote()(string obj_txt_in) { + obj_txt["munge"] = obj_txt_in; + return obj_txt["munge"]; +} +invariant() { +} #+END_SRC ******* group @@ -5860,14 +5866,14 @@ process and use an_object["table_head"] (then empty it) - drop spaces - keep newlines? -#+NAME: meta_emitters_obj_inline_markup_munge_7 +#+NAME: meta_emitters_obj_inline_markup_munge_function_group #+BEGIN_SRC d - @safe auto munge_group(string obj_txt_in) { - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n")); - return t; - } - invariant() { - } +@safe auto munge_group(string obj_txt_in) { + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in.split("\n\n").join(" \\\\\n \\\\\n")); + return t; +} +invariant() { +} #+END_SRC ******* block @@ -5881,14 +5887,14 @@ process and use an_object["table_head"] (then empty it) - keep newlines - newlines detected and kept? -#+NAME: meta_emitters_obj_inline_markup_munge_8 +#+NAME: meta_emitters_obj_inline_markup_munge_function_block #+BEGIN_SRC d - @safe auto munge_block()(string obj_txt_in) { - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); - return t; - } - invariant() { - } +@safe auto munge_block()(string obj_txt_in) { + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); + return t; +} +invariant() { +} #+END_SRC ******* verse (poem) @@ -5900,14 +5906,14 @@ process and use an_object["table_head"] (then empty it) - footnotes/endnotes - links? -#+NAME: meta_emitters_obj_inline_markup_munge_9 +#+NAME: meta_emitters_obj_inline_markup_munge_function_verse #+BEGIN_SRC d - @safe auto munge_verse()(string obj_txt_in) { - TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); - return t; - } - invariant() { - } +@safe auto munge_verse()(string obj_txt_in) { + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt_in); + return t; +} +invariant() { +} #+END_SRC ******* code @@ -5918,46 +5924,46 @@ process and use an_object["table_head"] (then empty it) - no general markup - one special character represented by mkup.nbsp ░ -#+NAME: meta_emitters_obj_inline_markup_munge_10 +#+NAME: meta_emitters_obj_inline_markup_munge_function_code #+BEGIN_SRC d - @safe string munge_code()(string obj_txt_in) { - obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); - obj_txt["munge"] = obj_txt_in; - return obj_txt["munge"]; - } - invariant() { - } +@safe string munge_code()(string obj_txt_in) { + obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); + obj_txt["munge"] = obj_txt_in; + return obj_txt["munge"]; +} +invariant() { +} #+END_SRC ******* table - table block identified by open an close tags - table markup -#+NAME: meta_emitters_obj_inline_markup_munge_11 +#+NAME: meta_emitters_obj_inline_markup_munge_function_table #+BEGIN_SRC d - @safe string munge_table()(string obj_txt_in) { - obj_txt["munge"] = obj_txt_in; - return obj_txt["munge"]; - } - invariant() { - } +@safe string munge_table()(string obj_txt_in) { + obj_txt["munge"] = obj_txt_in; + return obj_txt["munge"]; +} +invariant() { +} #+END_SRC ******* comment -#+NAME: meta_emitters_obj_inline_markup_munge_12 +#+NAME: meta_emitters_obj_inline_markup_munge_function_comment #+BEGIN_SRC d - @safe string munge_comment()(string obj_txt_in) { - obj_txt["munge"] = obj_txt_in; - return obj_txt["munge"]; - } - invariant() { - } +@safe string munge_comment()(string obj_txt_in) { + obj_txt["munge"] = obj_txt_in; + return obj_txt["munge"]; +} +invariant() { +} #+END_SRC ****** } -#+NAME: meta_emitters_obj_inline_markup_munge_13 +#+NAME: meta_emitters_obj_inline_markup_munge_function_close #+BEGIN_SRC d } #+END_SRC @@ -5965,7 +5971,7 @@ process and use an_object["table_head"] (then empty it) ***** toc, tags, object inline markup :markup:inline: ****** { -#+NAME: meta_emitters_obj_inline_markup +#+NAME: meta_emitters_obj_inline_markup_function_open #+BEGIN_SRC d static struct ObjInlineMarkup { static auto rgx = RgxI(); @@ -5978,404 +5984,404 @@ static struct ObjInlineMarkup { #+NAME: meta_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - @safe TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( - string[string] obj_, - string obj_key_, - CMM conf_make_meta, - Flag!"_new_doc" _new_doc - ) { - obj_txt["munge"] = obj_[obj_key_].dup; - obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) - ? obj_txt["munge"] - : obj_txt["munge"].strip; - if (_new_doc) { - anchor_tag = ""; - } - auto x = munge.init; - bool[string] obj_notes_and_links; - obj_notes_and_links["notes_reg"] = false; - obj_notes_and_links["notes_star"] = false; - obj_notes_and_links["links"] = false; - obj_notes_and_links["image_no_dimensions"] = false; - if ((obj_["is"] == "para") - || (obj_["is"] == "heading") - || (obj_["is"] == "quote") - || (obj_["is"] == "group") - || (obj_["is"] == "block") - || (obj_["is"] == "verse")) { - obj_txt["munge"] = (obj_txt["munge"]).inline_markup_faces; - obj_txt["munge"] = (obj_txt["munge"]).links_and_images; - } - switch (obj_["is"]) { - case "heading": - if (_new_doc) { - anchor_tag = ""; - } - obj_txt["munge"] = _configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta, _new_doc); - obj_txt["munge"] = _make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc); - if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { - anchor_tag = m.captures[1]; - } else if (obj_["lev"] == "1") { - writeln("heading anchor tag missing: ", obj_txt["munge"]); - } - x = munge.munge_heading(obj_txt["munge"], reset_note_numbers); - reset_note_numbers = false; - goto default; - case "para": - x = munge.munge_para(obj_txt["munge"]); - goto default; - case "group": - x = munge.munge_group(obj_txt["munge"]); - goto default; - case "block": - x = munge.munge_block(obj_txt["munge"]); - goto default; - case "verse": - x = munge.munge_verse(obj_txt["munge"]); - goto default; - case "code": - obj_txt["munge"] = munge.munge_code(obj_txt["munge"]); - break; - case "table": - obj_txt["munge"] = munge.munge_table(obj_txt["munge"]); - break; - case "quote": - obj_txt["munge"] = munge.munge_quote(obj_txt["munge"]); - break; - case "comment": - obj_txt["munge"] = munge.munge_comment(obj_txt["munge"]); - break; - case "doc_end_reset": - munge.initialize_note_numbers(); - break; - default: - /+ para, heading, group, block, verse +/ - obj_txt["munge"] = x[0]; - obj_notes_and_links["notes_reg"] = x[1]; - obj_notes_and_links["notes_star"] = x[2]; - obj_notes_and_links["notes_plus"] = x[3]; - obj_notes_and_links["links"] = x[4]; - obj_notes_and_links["image_no_dimensions"] = x[5]; - break; - } - TxtAndAnchorTagPlusHasFootnotesUrlsImages t = tuple( - obj_txt["munge"], - anchor_tag, - obj_notes_and_links["notes_reg"], - obj_notes_and_links["notes_star"], - obj_notes_and_links["links"], - obj_notes_and_links["image_no_dimensions"], - ); +@safe TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( + string[string] obj_, + string obj_key_, + CMM conf_make_meta, + Flag!"_new_doc" _new_doc +) { + obj_txt["munge"] = obj_[obj_key_].dup; + obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) + ? obj_txt["munge"] + : obj_txt["munge"].strip; + if (_new_doc) { anchor_tag = ""; - return t; } - invariant() { + auto x = munge.init; + bool[string] obj_notes_and_links; + obj_notes_and_links["notes_reg"] = false; + obj_notes_and_links["notes_star"] = false; + obj_notes_and_links["links"] = false; + obj_notes_and_links["image_no_dimensions"] = false; + if ((obj_["is"] == "para") + || (obj_["is"] == "heading") + || (obj_["is"] == "quote") + || (obj_["is"] == "group") + || (obj_["is"] == "block") + || (obj_["is"] == "verse")) { + obj_txt["munge"] = (obj_txt["munge"]).inline_markup_faces; + obj_txt["munge"] = (obj_txt["munge"]).links_and_images; + } + switch (obj_["is"]) { + case "heading": + if (_new_doc) { + anchor_tag = ""; + } + obj_txt["munge"] = _configured_auto_heading_numbering_and_segment_anchor_tags(obj_txt["munge"], obj_, conf_make_meta, _new_doc); + obj_txt["munge"] = _make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc); + if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { + anchor_tag = m.captures[1]; + } else if (obj_["lev"] == "1") { + writeln("heading anchor tag missing: ", obj_txt["munge"]); + } + x = munge.munge_heading(obj_txt["munge"], reset_note_numbers); + reset_note_numbers = false; + goto default; + case "para": + x = munge.munge_para(obj_txt["munge"]); + goto default; + case "group": + x = munge.munge_group(obj_txt["munge"]); + goto default; + case "block": + x = munge.munge_block(obj_txt["munge"]); + goto default; + case "verse": + x = munge.munge_verse(obj_txt["munge"]); + goto default; + case "code": + obj_txt["munge"] = munge.munge_code(obj_txt["munge"]); + break; + case "table": + obj_txt["munge"] = munge.munge_table(obj_txt["munge"]); + break; + case "quote": + obj_txt["munge"] = munge.munge_quote(obj_txt["munge"]); + break; + case "comment": + obj_txt["munge"] = munge.munge_comment(obj_txt["munge"]); + break; + case "doc_end_reset": + munge.initialize_note_numbers(); + break; + default: + /+ para, heading, group, block, verse +/ + obj_txt["munge"] = x[0]; + obj_notes_and_links["notes_reg"] = x[1]; + obj_notes_and_links["notes_star"] = x[2]; + obj_notes_and_links["notes_plus"] = x[3]; + obj_notes_and_links["links"] = x[4]; + obj_notes_and_links["image_no_dimensions"] = x[5]; + break; } + TxtAndAnchorTagPlusHasFootnotesUrlsImages t = tuple( + obj_txt["munge"], + anchor_tag, + obj_notes_and_links["notes_reg"], + obj_notes_and_links["notes_star"], + obj_notes_and_links["links"], + obj_notes_and_links["image_no_dimensions"], + ); + anchor_tag = ""; + return t; +} +invariant() { +} #+END_SRC ******* toc (table of contents), build, gather headings :markup:inline: #+NAME: meta_emitters_obj_inline_markup_table_of_contents #+BEGIN_SRC d - @safe auto _clean_heading_toc_()( - char[] heading_toc_, - ) { - auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); - heading_toc_ = (m.post).replaceAll(rgx.inline_notes_curly_gen, ""); - return heading_toc_; - }; - @safe ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)( - string[string] obj_, - CMM conf_make_meta, - string[string] tag_in_seg, - string _anchor_tag, - return ref string[][string] lev4_subtoc, - ObjGenericComposite[] the_table_of_contents_section, - ) { - ObjGenericComposite comp_obj_toc; - mixin InternalMarkup; - static auto mkup = InlineMarkup(); - char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])) - .replaceAll(rgx.inline_notes_al, ""); - heading_toc_ = _clean_heading_toc_(heading_toc_); - auto attrib = ""; - string toc_txt_, subtoc_txt_; - int[string] indent; - if (obj_["lev_markup_number"].to!int > 0) { - indent = [ - "hang_position" : obj_["lev_markup_number"].to!int, - "base_position" : obj_["lev_markup_number"].to!int, - ]; - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - heading_toc_.strip, - mkup.lnk_c, - mkup.url_o, - _anchor_tag, - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc = comp_obj_toc.init; - comp_obj_toc.metainfo.is_of_part = "frontmatter"; - comp_obj_toc.metainfo.is_of_section = "toc"; - comp_obj_toc.metainfo.is_of_type = "para"; - comp_obj_toc.metainfo.is_a = "toc"; - comp_obj_toc.metainfo.ocn = 0; - comp_obj_toc.metainfo.identifier = ""; - comp_obj_toc.metainfo.object_number_off = true; - comp_obj_toc.metainfo.object_number_type = 0; - comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.attrib.bullet = false; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; - } - comp_obj_toc = comp_obj_toc.init; - comp_obj_toc.metainfo.is_of_part = "frontmatter"; - comp_obj_toc.metainfo.is_of_section = "toc"; - comp_obj_toc.metainfo.is_of_type = "para"; - comp_obj_toc.metainfo.is_a = "toc"; - comp_obj_toc.metainfo.ocn = 0; - comp_obj_toc.metainfo.identifier = ""; - comp_obj_toc.metainfo.object_number_off = true; - comp_obj_toc.metainfo.object_number_type = 0; - comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; - comp_obj_toc.attrib.bullet = false; - comp_obj_toc.has.inline_links = true; - switch (obj_["lev_markup_number"].to!int) { - case 0: .. case 3: - break; - case 4: - lev4_subtoc[tag_in_seg["seg_lv4"]] = []; - break; - case 5: .. case 7: - subtoc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - heading_toc_.strip, - mkup.lnk_c, - mkup.url_o, - _anchor_tag, - mkup.url_c, - ); - lev4_subtoc[tag_in_seg["seg_lv4"]] - ~= links_and_images(obj_["lev_markup_number"] - ~ "~ " ~ subtoc_txt_.to!string.strip - ); - break; - default: - break; - } - return the_table_of_contents_section; - } - invariant() { +@safe auto _clean_heading_toc_()( + char[] heading_toc_, +) { + auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); + heading_toc_ = (m.post).replaceAll(rgx.inline_notes_curly_gen, ""); + return heading_toc_; +}; +@safe ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)( + string[string] obj_, + CMM conf_make_meta, + string[string] tag_in_seg, + string _anchor_tag, + return ref string[][string] lev4_subtoc, + ObjGenericComposite[] the_table_of_contents_section, +) { + ObjGenericComposite comp_obj_toc; + mixin InternalMarkup; + static auto mkup = InlineMarkup(); + char[] heading_toc_ = (obj_["substantive"].dup.strip.to!(char[])) + .replaceAll(rgx.inline_notes_al, ""); + heading_toc_ = _clean_heading_toc_(heading_toc_); + auto attrib = ""; + string toc_txt_, subtoc_txt_; + int[string] indent; + if (obj_["lev_markup_number"].to!int > 0) { + indent = [ + "hang_position" : obj_["lev_markup_number"].to!int, + "base_position" : obj_["lev_markup_number"].to!int, + ]; + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + heading_toc_.strip, + mkup.lnk_c, + mkup.url_o, + _anchor_tag, + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.metainfo.is_of_part = "frontmatter"; + comp_obj_toc.metainfo.is_of_section = "toc"; + comp_obj_toc.metainfo.is_of_type = "para"; + comp_obj_toc.metainfo.is_a = "toc"; + comp_obj_toc.metainfo.ocn = 0; + comp_obj_toc.metainfo.identifier = ""; + comp_obj_toc.metainfo.object_number_off = true; + comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; + comp_obj_toc.attrib.indent_hang = indent["hang_position"]; + comp_obj_toc.attrib.indent_base = indent["base_position"]; + comp_obj_toc.attrib.bullet = false; + comp_obj_toc.text = toc_txt_.to!string.strip; + comp_obj_toc.has.inline_links = true; + the_table_of_contents_section ~= comp_obj_toc; + } + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.metainfo.is_of_part = "frontmatter"; + comp_obj_toc.metainfo.is_of_section = "toc"; + comp_obj_toc.metainfo.is_of_type = "para"; + comp_obj_toc.metainfo.is_a = "toc"; + comp_obj_toc.metainfo.ocn = 0; + comp_obj_toc.metainfo.identifier = ""; + comp_obj_toc.metainfo.object_number_off = true; + comp_obj_toc.metainfo.object_number_type = 0; + comp_obj_toc.metainfo.dummy_heading = (an_object["dummy_heading_status"] == "t") ? true: false; + comp_obj_toc.attrib.bullet = false; + comp_obj_toc.has.inline_links = true; + switch (obj_["lev_markup_number"].to!int) { + case 0: .. case 3: + break; + case 4: + lev4_subtoc[tag_in_seg["seg_lv4"]] = []; + break; + case 5: .. case 7: + subtoc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + heading_toc_.strip, + mkup.lnk_c, + mkup.url_o, + _anchor_tag, + mkup.url_c, + ); + lev4_subtoc[tag_in_seg["seg_lv4"]] + ~= links_and_images(obj_["lev_markup_number"] + ~ "~ " ~ subtoc_txt_.to!string.strip + ); + break; + default: + break; } + return the_table_of_contents_section; +} +invariant() { +} #+END_SRC ******* private: -#+NAME: meta_emitters_obj_inline_markup_private +#+NAME: meta_emitters_obj_inline_markup_private_function_open #+BEGIN_SRC d private: #+END_SRC ******** make heading number & segment anchor tags if instructed :markup:inline:segment:anchor:tags: -#+NAME: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags_0 -#+BEGIN_SRC d - static int[] heading_num = [ 0, 0, 0, 0 ]; - static string heading_number_auto_composite = ""; - static string heading_number_auto_composite_segname = ""; - static bool[] auto_heading_numbering = [ true, true, true, true]; - @safe static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( - string munge_, - string[string] obj_, - CMM conf_make_meta, - bool _new_doc, - ) { - if (_new_doc) { - heading_num = [ 0, 0, 0, 0 ]; - heading_number_auto_composite = ""; - auto_heading_numbering = [ true, true, true, true]; - } - if (conf_make_meta.make.auto_num_top_lv) { - if (obj_["lev_markup_number"].to!int == 0) { - heading_num[0] = 0; - heading_num[1] = 0; - heading_num[2] = 0; - heading_num[3] = 0; - heading_number_auto_composite = ""; - } - /+ auto_num_depth minimum 0 - (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ - if ( - conf_make_meta.make.auto_num_top_lv - > obj_["lev_markup_number"].to!uint - ) { - heading_num[1] = 0; - heading_num[2] = 0; - heading_num[3] = 0; - } else if ( - conf_make_meta.make.auto_num_top_lv - == obj_["lev_markup_number"].to!uint - ) { - auto_heading_numbering[0] = - (munge_.match(rgx.auto_heading_numbering_off_lv1)) ? false : true; - if (auto_heading_numbering[0]) { - heading_num[0] ++; - } - heading_num[1] = 0; - heading_num[2] = 0; - heading_num[3] = 0; - } else if ( - conf_make_meta.make.auto_num_top_lv - == (obj_["lev_markup_number"].to!uint - 1) - ) { - auto_heading_numbering[1] = - (munge_.match(rgx.auto_heading_numbering_off_lv2)) ? false : true; - if (auto_heading_numbering[0] - && auto_heading_numbering[1]) { - heading_num[1] ++; - } - heading_num[2] = 0; - heading_num[3] = 0; - } else if ( - conf_make_meta.make.auto_num_top_lv - == (obj_["lev_markup_number"].to!uint - 2) - ) { - auto_heading_numbering[2] = - (munge_.match(rgx.auto_heading_numbering_off_lv3)) ? false : true; - if (auto_heading_numbering[0] - && auto_heading_numbering[1] - && auto_heading_numbering[2]) { - heading_num[2] ++; - } - heading_num[3] = 0; - } else if ( - conf_make_meta.make.auto_num_top_lv - == (obj_["lev_markup_number"].to!uint - 3) - ) { - auto_heading_numbering[3] = - (munge_.match(rgx.auto_heading_numbering_off_lv4)) ? false : true; - if (auto_heading_numbering[0] - && auto_heading_numbering[1] - && auto_heading_numbering[2] - && auto_heading_numbering[3]) { - heading_num[3] ++; - } - } +#+NAME: meta_emitters_obj_inline_markup_heading_numbering_and_segment_anchor_tags +#+BEGIN_SRC d +static int[] heading_num = [ 0, 0, 0, 0 ]; +static string heading_number_auto_composite = ""; +static string heading_number_auto_composite_segname = ""; +static bool[] auto_heading_numbering = [ true, true, true, true]; +@safe static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( + string munge_, + string[string] obj_, + CMM conf_make_meta, + bool _new_doc, +) { + if (_new_doc) { + heading_num = [ 0, 0, 0, 0 ]; + heading_number_auto_composite = ""; + auto_heading_numbering = [ true, true, true, true]; + } + if (conf_make_meta.make.auto_num_top_lv) { + if (obj_["lev_markup_number"].to!int == 0) { + heading_num[0] = 0; + heading_num[1] = 0; + heading_num[2] = 0; + heading_num[3] = 0; + heading_number_auto_composite = ""; + } + /+ auto_num_depth minimum 0 + (1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/ + if ( + conf_make_meta.make.auto_num_top_lv + > obj_["lev_markup_number"].to!uint + ) { + heading_num[1] = 0; + heading_num[2] = 0; + heading_num[3] = 0; + } else if ( + conf_make_meta.make.auto_num_top_lv + == obj_["lev_markup_number"].to!uint + ) { + auto_heading_numbering[0] = + (munge_.match(rgx.auto_heading_numbering_off_lv1)) ? false : true; if (auto_heading_numbering[0]) { - if (heading_num[3] > 0) { - heading_number_auto_composite - = (conf_make_meta.make.auto_num_depth.to!uint == 3 - && auto_heading_numbering[3]) - ? (format(q"┃%s.%s.%s.%s┃", - heading_num[0].to!string, - heading_num[1].to!string, - heading_num[2].to!string, - heading_num[3].to!string - )) - : ""; - } else if (heading_num[2] > 0) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3) - && auto_heading_numbering[2]) - ? (format(q"┃%s.%s.%s┃", - heading_num[0].to!string, - heading_num[1].to!string, - heading_num[2].to!string - )) - : ""; - } else if (heading_num[1] > 0) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3) - && auto_heading_numbering[1]) - ? (format(q"┃%s.%s┃", - heading_num[0].to!string, - heading_num[1].to!string - )) - : ""; - } else if (heading_num[0] > 0 - && munge_.match(rgx.auto_heading_numbering_lv1) - ) { - heading_number_auto_composite - = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) - && (conf_make_meta.make.auto_num_depth.to!uint <= 3) - && auto_heading_numbering[0]) - ? (format(q"┃%s┃", - heading_num[0].to!string - )) - : ""; - } else { - heading_number_auto_composite = ""; - } - } - heading_number_auto_composite_segname = - (heading_number_auto_composite.empty) - ? "" - : "seg_" ~ heading_number_auto_composite; - debug(heading_number_auto) { - writeln(heading_number_auto_composite); - } - if ((!empty(heading_number_auto_composite)) - && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) { - munge_ = munge_ - .replaceFirst(rgx.heading, - "$1~$2 " ~ heading_number_auto_composite ~ ". ") - .replaceFirst(rgx.heading_marker_missing_tag, - "$1~" ~ heading_number_auto_composite_segname ~ " "); + heading_num[0] ++; + } + heading_num[1] = 0; + heading_num[2] = 0; + heading_num[3] = 0; + } else if ( + conf_make_meta.make.auto_num_top_lv + == (obj_["lev_markup_number"].to!uint - 1) + ) { + auto_heading_numbering[1] = + (munge_.match(rgx.auto_heading_numbering_off_lv2)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1]) { + heading_num[1] ++; + } + heading_num[2] = 0; + heading_num[3] = 0; + } else if ( + conf_make_meta.make.auto_num_top_lv + == (obj_["lev_markup_number"].to!uint - 2) + ) { + auto_heading_numbering[2] = + (munge_.match(rgx.auto_heading_numbering_off_lv3)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1] + && auto_heading_numbering[2]) { + heading_num[2] ++; + } + heading_num[3] = 0; + } else if ( + conf_make_meta.make.auto_num_top_lv + == (obj_["lev_markup_number"].to!uint - 3) + ) { + auto_heading_numbering[3] = + (munge_.match(rgx.auto_heading_numbering_off_lv4)) ? false : true; + if (auto_heading_numbering[0] + && auto_heading_numbering[1] + && auto_heading_numbering[2] + && auto_heading_numbering[3]) { + heading_num[3] ++; + } + } + if (auto_heading_numbering[0]) { + if (heading_num[3] > 0) { + heading_number_auto_composite + = (conf_make_meta.make.auto_num_depth.to!uint == 3 + && auto_heading_numbering[3]) + ? (format(q"┃%s.%s.%s.%s┃", + heading_num[0].to!string, + heading_num[1].to!string, + heading_num[2].to!string, + heading_num[3].to!string + )) + : ""; + } else if (heading_num[2] > 0) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 2) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[2]) + ? (format(q"┃%s.%s.%s┃", + heading_num[0].to!string, + heading_num[1].to!string, + heading_num[2].to!string + )) + : ""; + } else if (heading_num[1] > 0) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 1) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[1]) + ? (format(q"┃%s.%s┃", + heading_num[0].to!string, + heading_num[1].to!string + )) + : ""; + } else if (heading_num[0] > 0 + && munge_.match(rgx.auto_heading_numbering_lv1) + ) { + heading_number_auto_composite + = ((conf_make_meta.make.auto_num_depth.to!uint >= 0) + && (conf_make_meta.make.auto_num_depth.to!uint <= 3) + && auto_heading_numbering[0]) + ? (format(q"┃%s┃", + heading_num[0].to!string + )) + : ""; + } else { + heading_number_auto_composite = ""; } } - return munge_; + heading_number_auto_composite_segname = + (heading_number_auto_composite.empty) + ? "" + : "seg_" ~ heading_number_auto_composite; + debug(heading_number_auto) { + writeln(heading_number_auto_composite); + } + if ((!empty(heading_number_auto_composite)) + && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) { + munge_ = munge_ + .replaceFirst(rgx.heading, + "$1~$2 " ~ heading_number_auto_composite ~ ". ") + .replaceFirst(rgx.heading_marker_missing_tag, + "$1~" ~ heading_number_auto_composite_segname ~ " "); + } } + return munge_; +} #+END_SRC ******** make segment anchor tags if not provided :markup:inline:segment:anchor:tags: -#+NAME: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags_1 +#+NAME: meta_emitters_obj_inline_segment_anchor_tags_manufacture #+BEGIN_SRC d - static int heading_num_lev1 = 0; - @safe static string _make_segment_anchor_tags_if_none_provided()( - string munge_, - string lev_, - bool _new_doc - ) { - if (!(munge_.match(rgx.heading_anchor_tag))) { - if (munge_.match(rgx.heading_identify_anchor_tag)) { - if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { - munge_ = munge_.replaceFirst( - rgx.heading_marker_missing_tag, - "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); - if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { - auto tag_remunge_ = n.captures[2] - .replaceAll(rgx.heading_marker_tag_has_colon, ".."); - munge_ = munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); - } - } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { - munge_ = munge_.replaceFirst( - rgx.heading_marker_missing_tag, - "$1~" ~ "s" ~ m.captures[1] ~ " "); - } - } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev == "1" - if (_new_doc) { - heading_num_lev1 = 0; +static int heading_num_lev1 = 0; +@safe static string _make_segment_anchor_tags_if_none_provided()( + string munge_, + string lev_, + bool _new_doc +) { + if (!(munge_.match(rgx.heading_anchor_tag))) { + if (munge_.match(rgx.heading_identify_anchor_tag)) { + if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { + munge_ = munge_.replaceFirst( + rgx.heading_marker_missing_tag, + "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); + if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { + auto tag_remunge_ = n.captures[2] + .replaceAll(rgx.heading_marker_tag_has_colon, ".."); + munge_ = munge_.replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); } - heading_num_lev1 ++; + } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { munge_ = munge_.replaceFirst( rgx.heading_marker_missing_tag, - "$1~" ~ "x" ~ heading_num_lev1.to!string ~ " "); + "$1~" ~ "s" ~ m.captures[1] ~ " "); } + } else if (lev_ == "1") { // (if not successful) manufacture a unique anchor tag for lev == "1" + if (_new_doc) { + heading_num_lev1 = 0; + } + heading_num_lev1 ++; + munge_ = munge_.replaceFirst( + rgx.heading_marker_missing_tag, + "$1~" ~ "x" ~ heading_num_lev1.to!string ~ " "); } - return munge_; } + return munge_; +} #+END_SRC ****** } -#+NAME: meta_emitters_obj_inline_markup_close +#+NAME: meta_emitters_obj_inline_markup_private_function_close #+BEGIN_SRC d } #+END_SRC @@ -6393,258 +6399,258 @@ struct ObjAttributes { #+NAME: meta_emitters_obj_attributes_public #+BEGIN_SRC d - @safe string obj_attributes()( - string obj_is_, - string obj_raw, - ObjGenericComposite _comp_obj_heading, - ) { - scope(exit) { - destroy(obj_is_); - destroy(obj_raw); - destroy(_comp_obj_heading); - } - _obj_attrib["json"] ="{"; - switch (obj_is_) { - case "heading": - _obj_attrib["json"] ~= txt_heading(obj_raw); - break; - case "para": - _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) - ~ txt_para(obj_raw); - break; - case "code": - _obj_attrib["json"] ~= txt_code(obj_raw); - break; - case "group": - _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) - ~ txt_group(obj_raw); - break; - case "block": - _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) - ~ txt_block(obj_raw); - break; - case "verse": - _obj_attrib["json"] ~= txt_verse(obj_raw); - break; - case "quote": - _obj_attrib["json"] ~= txt_quote(obj_raw); - break; - case "table": - _obj_attrib["json"] ~= txt_table(obj_raw); - break; - case "comment": - _obj_attrib["json"] ~= txt_comment(obj_raw); - break; - default: - _obj_attrib["json"] ~= txt_para(obj_raw); - break; - } - _obj_attrib["json"] ~= " }"; - _obj_attrib["json"] = _set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); - debug(structattrib) { - if (oa_j["is"].str() == "heading") { - writeln(_obj_attrib["json"]); - writeln( - "is: ", oa_j["is"].str(), - "; object_number: ", oa_j["object_number"].integer() - ); - } - } - return _obj_attrib["json"]; +@safe string obj_attributes()( + string obj_is_, + string obj_raw, + ObjGenericComposite _comp_obj_heading, +) { + scope(exit) { + destroy(obj_is_); + destroy(obj_raw); + destroy(_comp_obj_heading); + } + _obj_attrib["json"] ="{"; + switch (obj_is_) { + case "heading": + _obj_attrib["json"] ~= txt_heading(obj_raw); + break; + case "para": + _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) + ~ txt_para(obj_raw); + break; + case "code": + _obj_attrib["json"] ~= txt_code(obj_raw); + break; + case "group": + _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) + ~ txt_group(obj_raw); + break; + case "block": + _obj_attrib["json"] ~= txt_para_and_blocks(obj_raw) + ~ txt_block(obj_raw); + break; + case "verse": + _obj_attrib["json"] ~= txt_verse(obj_raw); + break; + case "quote": + _obj_attrib["json"] ~= txt_quote(obj_raw); + break; + case "table": + _obj_attrib["json"] ~= txt_table(obj_raw); + break; + case "comment": + _obj_attrib["json"] ~= txt_comment(obj_raw); + break; + default: + _obj_attrib["json"] ~= txt_para(obj_raw); + break; } - invariant() { + _obj_attrib["json"] ~= " }"; + _obj_attrib["json"] = _set_additional_values_parse_as_json(_obj_attrib["json"], obj_is_, _comp_obj_heading); + debug(structattrib) { + if (oa_j["is"].str() == "heading") { + writeln(_obj_attrib["json"]); + writeln( + "is: ", oa_j["is"].str(), + "; object_number: ", oa_j["object_number"].integer() + ); + } } + return _obj_attrib["json"]; +} +invariant() { +} #+END_SRC ******* private #+NAME: meta_emitters_obj_attributes_private #+BEGIN_SRC d - private: - string _obj_attributes; +private: +string _obj_attributes; #+END_SRC ******** para & blocks -#+NAME: meta_emitters_obj_attributes_private_an_attribute_0 -#+BEGIN_SRC d - @safe string txt_para_and_blocks()(string obj_txt_in) { - if (obj_txt_in.matchFirst(rgx.para_bullet)) { - _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": 0," - ~ " \"indent_base\": 0,"; - } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { - _obj_attributes =" \"bullet\": \"true\"," - ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," - ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; - } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { - _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m["hang"].to!string ~ "," - ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; - } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { - _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," - ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; - } else { - _obj_attributes =" \"bullet\": \"false\"," - ~ " \"indent_hang\": 0," - ~ " \"indent_base\": 0,"; - } - return _obj_attributes; +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_para_and_blocks +#+BEGIN_SRC d +@safe string txt_para_and_blocks()(string obj_txt_in) { + if (obj_txt_in.matchFirst(rgx.para_bullet)) { + _obj_attributes =" \"bullet\": \"true\"," + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; + } else if (auto m = obj_txt_in.matchFirst(rgx.para_bullet_indent)) { + _obj_attributes =" \"bullet\": \"true\"," + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; + } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent_hang)) { + _obj_attributes =" \"bullet\": \"false\"," + ~ " \"indent_hang\": " ~ m["hang"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; + } else if (auto m = obj_txt_in.matchFirst(rgx.para_indent)) { + _obj_attributes =" \"bullet\": \"false\"," + ~ " \"indent_hang\": " ~ m["indent"].to!string ~ "," + ~ " \"indent_base\": " ~ m["indent"].to!string ~ ","; + } else { + _obj_attributes =" \"bullet\": \"false\"," + ~ " \"indent_hang\": 0," + ~ " \"indent_base\": 0,"; } + return _obj_attributes; +} #+END_SRC ******** heading -#+NAME: meta_emitters_obj_attributes_private_an_attribute_1 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_heading #+BEGIN_SRC d - @safe string txt_heading()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"para\"," - ~ " \"is\": \"heading\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_heading()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"para\"," + ~ " \"is\": \"heading\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** para -#+NAME: meta_emitters_obj_attributes_private_an_attribute_2 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_para #+BEGIN_SRC d - @safe string txt_para()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"para\"," - ~ " \"is\": \"para\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_para()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"para\"," + ~ " \"is\": \"para\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** quote -#+NAME: meta_emitters_obj_attributes_private_an_attribute_3 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_quote #+BEGIN_SRC d - @safe string txt_quote()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"quote\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_quote()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"quote\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** group -#+NAME: meta_emitters_obj_attributes_private_an_attribute_4 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_group #+BEGIN_SRC d - @safe string txt_group()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"group\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_group()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"group\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** block -#+NAME: meta_emitters_obj_attributes_private_an_attribute_5 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_block #+BEGIN_SRC d - @safe string txt_block()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"block\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_block()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"block\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** verse -#+NAME: meta_emitters_obj_attributes_private_an_attribute_6 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_verse #+BEGIN_SRC d - @safe string txt_verse()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"verse\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_verse()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"verse\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** code -#+NAME: meta_emitters_obj_attributes_private_an_attribute_7 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_code #+BEGIN_SRC d - @safe string txt_code()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"code\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_code()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"code\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** table -#+NAME: meta_emitters_obj_attributes_private_an_attribute_8 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_table #+BEGIN_SRC d - @safe string txt_table()(string obj_txt_in) { - _obj_attributes = " \"use\": \"content\"," - ~ " \"of\": \"block\"," - ~ " \"is\": \"table\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_table()(string obj_txt_in) { + _obj_attributes = " \"use\": \"content\"," + ~ " \"of\": \"block\"," + ~ " \"is\": \"table\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** comment -#+NAME: meta_emitters_obj_attributes_private_an_attribute_9 +#+NAME: meta_emitters_obj_attributes_private_an_attribute_txt_comment #+BEGIN_SRC d - @safe string txt_comment()(string obj_txt_in) { - _obj_attributes = " \"use\": \"comment\"," - ~ " \"of\": \"comment\"," - ~ " \"is\": \"comment\""; - return _obj_attributes; - } - invariant() { - } +@safe string txt_comment()(string obj_txt_in) { + _obj_attributes = " \"use\": \"comment\"," + ~ " \"of\": \"comment\"," + ~ " \"is\": \"comment\""; + return _obj_attributes; +} +invariant() { +} #+END_SRC ******** set additional attribute values, parse as json #+NAME: meta_emitters_obj_attributes_private_json #+BEGIN_SRC d - @safe string _set_additional_values_parse_as_json()( - string _obj_attrib, - string obj_is_, - ObjGenericComposite _comp_obj_heading, - ) { - JSONValue oa_j = parseJSON(_obj_attrib); - assert( - (oa_j.type == JSON_TYPE.OBJECT) - ); - if (obj_is_ == "heading") { - oa_j.object["object_number"] = _comp_obj_heading.metainfo.ocn; - oa_j.object["lev_markup_number"] = _comp_obj_heading.metainfo.heading_lev_markup; - oa_j.object["lev_collapsed_number"] = _comp_obj_heading.metainfo.heading_lev_collapsed; - oa_j.object["heading_ptr"] = _comp_obj_heading.ptr.heading; - oa_j.object["doc_object_ptr"] = _comp_obj_heading.ptr.doc_object; - } - oa_j.object["parent_object_number"] = _comp_obj_heading.metainfo.parent_ocn; - oa_j.object["parent_lev_markup_number"] = _comp_obj_heading.metainfo.parent_lev_markup; - _obj_attrib = oa_j.toString(); - return _obj_attrib; - } +@safe string _set_additional_values_parse_as_json()( + string _obj_attrib, + string obj_is_, + ObjGenericComposite _comp_obj_heading, +) { + JSONValue oa_j = parseJSON(_obj_attrib); + assert( + (oa_j.type == JSON_TYPE.OBJECT) + ); + if (obj_is_ == "heading") { + oa_j.object["object_number"] = _comp_obj_heading.metainfo.ocn; + oa_j.object["lev_markup_number"] = _comp_obj_heading.metainfo.heading_lev_markup; + oa_j.object["lev_collapsed_number"] = _comp_obj_heading.metainfo.heading_lev_collapsed; + oa_j.object["heading_ptr"] = _comp_obj_heading.ptr.heading; + oa_j.object["doc_object_ptr"] = _comp_obj_heading.ptr.doc_object; + } + oa_j.object["parent_object_number"] = _comp_obj_heading.metainfo.parent_ocn; + oa_j.object["parent_lev_markup_number"] = _comp_obj_heading.metainfo.parent_lev_markup; + _obj_attrib = oa_j.toString(); + return _obj_attrib; +} #+END_SRC ****** } @@ -6657,7 +6663,7 @@ struct ObjAttributes { **** book index :book:index: ***** book index nugget hash :hash:nugget: -#+NAME: meta_emitters_book_index_nugget +#+NAME: meta_emitters_bookindex_nugget #+BEGIN_SRC d struct BookIndexNuggetHash { string main_term, sub_term, sub_term_bits; @@ -6737,7 +6743,7 @@ struct BookIndexNuggetHash { ***** book index (sort &) report indented :report:indented: -#+NAME: meta_emitters_book_index_report_indented +#+NAME: meta_emitters_bookindex_report_indented #+BEGIN_SRC d struct BookIndexReportIndent { int mkn, skn; @@ -6770,7 +6776,7 @@ struct BookIndexReportIndent { ***** book index (sort &) report section :report:section: ****** { book index struct open -#+NAME: meta_emitters_book_index_report_section_0 +#+NAME: meta_emitters_bookindex_report_section_function_open #+BEGIN_SRC d struct BookIndexReportSection { int mkn, skn; @@ -6780,212 +6786,212 @@ struct BookIndexReportSection { ******* bookindex write section -#+NAME: meta_emitters_book_index_report_section_1 +#+NAME: meta_emitters_bookindex_report_section_function_write_section #+BEGIN_SRC d - @safe void bookindex_write_section()( - string[][string][string] bookindex_unordered_hashes - ) { - auto mainkeys = - bookindex_unordered_hashes.byKey.array +@safe void bookindex_write_section()( + string[][string][string] bookindex_unordered_hashes +) { + auto mainkeys = + bookindex_unordered_hashes.byKey.array + .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; + foreach (mainkey; mainkeys) { + write("_0_1 !┨", mainkey, "┣! "); + foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { + auto go = ref_.replaceAll(rgx.book_index_go, "$1"); + write(" {", ref_, "}#", go, ", "); + } + writeln(" \\\\"); + bookindex_unordered_hashes[mainkey].remove("_a"); + auto subkeys = + bookindex_unordered_hashes[mainkey].byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; - foreach (mainkey; mainkeys) { - write("_0_1 !┨", mainkey, "┣! "); - foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { + foreach (subkey; subkeys) { + write(" ", subkey, ", "); + foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); } writeln(" \\\\"); - bookindex_unordered_hashes[mainkey].remove("_a"); - auto subkeys = - bookindex_unordered_hashes[mainkey].byKey.array - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; - foreach (subkey; subkeys) { - write(" ", subkey, ", "); - foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { - auto go = ref_.replaceAll(rgx.book_index_go, "$1"); - write(" {", ref_, "}#", go, ", "); - } - writeln(" \\\\"); - ++skn; - } - ++mkn; + ++skn; } + ++mkn; } +} #+END_SRC ******* book index (sort &) build section :report:section: -#+NAME: meta_emitters_book_index_report_section_2 +#+NAME: meta_emitters_bookindex_report_section_function_build_abstraction #+BEGIN_SRC d - @system auto bookindex_build_abstraction_section(N,B)( - string[][string][string] bookindex_unordered_hashes, - N obj_cite_digits, - B opt_action, - ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } - mixin spineNode; - mixin InternalMarkup; - static auto mkup = InlineMarkup(); - string type_is; - string lev; - int heading_lev_markup, heading_lev_collapsed; - string attrib; - int[string] indent; - auto mainkeys = - bookindex_unordered_hashes.byKey.array - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; - ObjGenericComposite[] bookindex_section; - ObjGenericComposite comp_obj_heading_, comp_obj_para; - auto node_para_int_ = node_metadata_para_int; - auto node_para_str_ = node_metadata_para_str; - if ((mainkeys.length > 0) - && (opt_action.backmatter - && opt_action.section_bookindex)) { - string bi_tmp; - string[] bi_tmp_tags; - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bookindex"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Book Index"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = false; - comp_obj_heading_.metainfo.object_number_off = false; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = "bookindex"; - comp_obj_heading_.tags.anchor_tags = ["section_bookindex"]; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading.has.inline_links = true; - bookindex_section ~= comp_obj_heading_; - 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; - ++mkn; +@system auto bookindex_build_abstraction_section(N,B)( + string[][string][string] bookindex_unordered_hashes, + N obj_cite_digits, + B opt_action, +) { + debug(asserts) { + static assert(is(typeof(obj_cite_digits.object_number) == int)); + } + mixin spineNode; + mixin InternalMarkup; + static auto mkup = InlineMarkup(); + string type_is; + string lev; + int heading_lev_markup, heading_lev_collapsed; + string attrib; + int[string] indent; + auto mainkeys = + bookindex_unordered_hashes.byKey.array + .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; + ObjGenericComposite[] bookindex_section; + ObjGenericComposite comp_obj_heading_, comp_obj_para; + auto node_para_int_ = node_metadata_para_int; + auto node_para_str_ = node_metadata_para_str; + if ((mainkeys.length > 0) + && (opt_action.backmatter + && opt_action.section_bookindex)) { + string bi_tmp; + string[] bi_tmp_tags; + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bookindex"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Book Index"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; + comp_obj_heading_.metainfo.object_number_off = false; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "bookindex"; + comp_obj_heading_.tags.anchor_tags = ["section_bookindex"]; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading.has.inline_links = true; + bookindex_section ~= comp_obj_heading_; + 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + ++mkn; + } + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bookindex"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Index"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; + comp_obj_heading_.metainfo.heading_lev_markup = 4; + comp_obj_heading_.metainfo.heading_lev_collapsed = 2; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading.has.inline_links = false; + comp_obj_heading_.tags.anchor_tags = ["bookindex"]; + bookindex_section ~= comp_obj_heading_; + 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + ++mkn; + } + import std.array : appender; + auto buffer = appender!(char[])(); + string[dchar] transTable = [' ' : "_"]; + foreach (mainkey; mainkeys) { + bi_tmp_tags = [""]; + bi_tmp = mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; + buffer.clear(); + bi_tmp_tags ~= translate(mainkey, transTable); + auto bkidx_lnk(string locs) { + string markup = ""; + if (auto m = locs.matchFirst(rgx.book_index_go)) { + markup + = links_and_images("{ " ~ m["link"] ~ " }" + ~ "#" ~ m["ocn"] ~ ", "); + } else { + writeln(__LINE__, ": ", locs); + } + return markup; } - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bookindex"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Index"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; - comp_obj_heading_.metainfo.heading_lev_markup = 4; - comp_obj_heading_.metainfo.heading_lev_collapsed = 2; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading.has.inline_links = false; - comp_obj_heading_.tags.anchor_tags = ["bookindex"]; - bookindex_section ~= comp_obj_heading_; - 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; - ++mkn; - } - import std.array : appender; - auto buffer = appender!(char[])(); - string[dchar] transTable = [' ' : "_"]; - foreach (mainkey; mainkeys) { - bi_tmp_tags = [""]; - bi_tmp = mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; + foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { + bi_tmp ~= bkidx_lnk(ref_); + } + bi_tmp ~= " \\\\\n "; + bookindex_unordered_hashes[mainkey].remove("_a"); + auto subkeys = + bookindex_unordered_hashes[mainkey].byKey.array + .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; + foreach (subkey; subkeys) { + bi_tmp ~= subkey ~ ", "; buffer.clear(); - bi_tmp_tags ~= translate(mainkey, transTable); - auto bkidx_lnk(string locs) { - string markup = ""; - if (auto m = locs.matchFirst(rgx.book_index_go)) { - markup - = links_and_images("{ " ~ m["link"] ~ " }" - ~ "#" ~ m["ocn"] ~ ", "); - } else { - writeln(__LINE__, ": ", locs); - } - return markup; - } - foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { + bi_tmp_tags ~= translate(subkey, transTable); + foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { bi_tmp ~= bkidx_lnk(ref_); } bi_tmp ~= " \\\\\n "; - bookindex_unordered_hashes[mainkey].remove("_a"); - auto subkeys = - bookindex_unordered_hashes[mainkey].byKey.array - .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; - foreach (subkey; subkeys) { - bi_tmp ~= subkey ~ ", "; - buffer.clear(); - bi_tmp_tags ~= translate(subkey, transTable); - foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { - bi_tmp ~= bkidx_lnk(ref_); - } - bi_tmp ~= " \\\\\n "; - ++skn; - } - bi_tmp = bi_tmp.replaceFirst(rgx.trailing_linebreak, ""); - comp_obj_para = comp_obj_para.init; - comp_obj_para.metainfo.is_of_part = "backmatter"; - comp_obj_para.metainfo.is_of_section = "bookindex"; - comp_obj_para.metainfo.is_of_type = "para"; - comp_obj_para.metainfo.is_a = "bookindex"; - comp_obj_para.text = bi_tmp.to!string.strip; - comp_obj_para.metainfo.ocn = 0; - comp_obj_para.metainfo.identifier = ""; - comp_obj_para.metainfo.object_number_off = true; - comp_obj_para.metainfo.object_number_type = 0; - comp_obj_para.tags.anchor_tags = bi_tmp_tags; - comp_obj_para.attrib.indent_hang = 0; - comp_obj_para.attrib.indent_base = 1; - comp_obj_para.attrib.bullet = false; - comp_obj_para.has.inline_links = true; - comp_obj_para.text = bi_tmp.to!string.strip; - bookindex_section ~= comp_obj_para; - ++mkn; - } - } else { // no book index, (figure out what to do here) - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.text = "(skip) there is no Book Index"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - bookindex_section ~= comp_obj_heading_; - } - auto t = tuple( - bookindex_section, - obj_cite_digits - ); - return t; - } + ++skn; + } + bi_tmp = bi_tmp.replaceFirst(rgx.trailing_linebreak, ""); + comp_obj_para = comp_obj_para.init; + comp_obj_para.metainfo.is_of_part = "backmatter"; + comp_obj_para.metainfo.is_of_section = "bookindex"; + comp_obj_para.metainfo.is_of_type = "para"; + comp_obj_para.metainfo.is_a = "bookindex"; + comp_obj_para.text = bi_tmp.to!string.strip; + comp_obj_para.metainfo.ocn = 0; + comp_obj_para.metainfo.identifier = ""; + comp_obj_para.metainfo.object_number_off = true; + comp_obj_para.metainfo.object_number_type = 0; + comp_obj_para.tags.anchor_tags = bi_tmp_tags; + comp_obj_para.attrib.indent_hang = 0; + comp_obj_para.attrib.indent_base = 1; + comp_obj_para.attrib.bullet = false; + comp_obj_para.has.inline_links = true; + comp_obj_para.text = bi_tmp.to!string.strip; + bookindex_section ~= comp_obj_para; + ++mkn; + } + } else { // no book index, (figure out what to do here) + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.text = "(skip) there is no Book Index"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + bookindex_section ~= comp_obj_heading_; + } + auto t = tuple( + bookindex_section, + obj_cite_digits + ); + return t; +} #+END_SRC ****** } -#+NAME: meta_emitters_book_index_report_section_3 +#+NAME: meta_emitters_bookindex_report_section_function_close #+BEGIN_SRC d } #+END_SRC **** (end)notes section :endnotes:section: -#+NAME: meta_emitters_endnotes_0 +#+NAME: meta_emitters_endnotes_function_open #+BEGIN_SRC d struct NotesSection { string[string] object_notes; @@ -6996,226 +7002,226 @@ struct NotesSection { ***** { gather notes for endnote section struct open -#+NAME: meta_emitters_endnotes_1 +#+NAME: meta_emitters_endnotes_function_gather_notes #+BEGIN_SRC d - @safe private auto gather_notes_for_endnote_section( - ObjGenericComposite[] contents_am, - string[string] tag_in_seg, - int cntr, +@safe private auto gather_notes_for_endnote_section( + ObjGenericComposite[] contents_am, + string[string] tag_in_seg, + int cntr, +) { + assert((contents_am[cntr].metainfo.is_a == "para") + || (contents_am[cntr].metainfo.is_a == "heading") + || (contents_am[cntr].metainfo.is_a == "quote") + || (contents_am[cntr].metainfo.is_a == "group") + || (contents_am[cntr].metainfo.is_a == "block") + || (contents_am[cntr].metainfo.is_a == "verse")); + assert(cntr >= previous_count); + assert( + (contents_am[cntr].text).match( + rgx.inline_notes_al_all_note) + ); + mixin InternalMarkup; + previous_count = cntr; + static auto mkup = InlineMarkup(); + static auto munge = ObjInlineMarkupMunge(); + foreach(m; + (contents_am[cntr].text).matchAll( + rgx.inline_notes_al_special_char_note) ) { - assert((contents_am[cntr].metainfo.is_a == "para") - || (contents_am[cntr].metainfo.is_a == "heading") - || (contents_am[cntr].metainfo.is_a == "quote") - || (contents_am[cntr].metainfo.is_a == "group") - || (contents_am[cntr].metainfo.is_a == "block") - || (contents_am[cntr].metainfo.is_a == "verse")); - assert(cntr >= previous_count); - assert( - (contents_am[cntr].text).match( - rgx.inline_notes_al_all_note) - ); - mixin InternalMarkup; - previous_count = cntr; - static auto mkup = InlineMarkup(); - static auto munge = ObjInlineMarkupMunge(); - foreach(m; - (contents_am[cntr].text).matchAll( - rgx.inline_notes_al_special_char_note) - ) { - debug(endnotes_build) { - writeln( - "{^", mkup.ff_o, m["char"], ".", mkup.ff_c, "^}" - ~ mkup.mark_internal_site_lnk, - tag_in_seg["seg_lv4"], - ".fnSuffix#noteref_\n ", m["char"], " ", - m["note"]); // sometimes need segment name (segmented html & epub) - } - // you need anchor for segments at this point -> - object_notes["anchor"] ~= "note_" ~ m["char"] ~ "』"; - object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) - ? (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" - ~ m["char"]) ~ " " - ~ m["note"] ~ "』" - ) - : (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" - ~ mkup.mark_internal_site_lnk - ~ tag_in_seg["seg_lv4"] - ~ ".fnSuffix#noteref_" - ~ m["char"]) ~ " " - ~ m["note"] ~ "』" - ); - } - foreach(m; - (contents_am[cntr].text).matchAll( - rgx.inline_notes_al_regular_number_note) - ) { - debug(endnotes_build) { - writeln( - "{^", mkup.ff_o, m["num"], ".", mkup.ff_c, "^}" - ~ mkup.mark_internal_site_lnk, - tag_in_seg["seg_lv4"], - ".fnSuffix#noteref_\n ", m["num"], " ", - m["note"]); // sometimes need segment name (segmented html & epub) - } - // you need anchor for segments at this point -> - object_notes["anchor"] ~= "note_" ~ m["num"] ~ "』"; - object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) - ? (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" - ~ m["num"]) ~ " " - ~ m["note"] ~ "』" - ) - : (links_and_images( - "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" - ~ mkup.mark_internal_site_lnk - ~ tag_in_seg["seg_lv4"] - ~ ".fnSuffix#noteref_" - ~ m["num"]) ~ " " - ~ m["note"] ~ "』" - ); - } - return object_notes; + debug(endnotes_build) { + writeln( + "{^", mkup.ff_o, m["char"], ".", mkup.ff_c, "^}" + ~ mkup.mark_internal_site_lnk, + tag_in_seg["seg_lv4"], + ".fnSuffix#noteref_\n ", m["char"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) + } + // you need anchor for segments at this point -> + object_notes["anchor"] ~= "note_" ~ m["char"] ~ "』"; + object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) + ? (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ) + : (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + ~ mkup.mark_internal_site_lnk + ~ tag_in_seg["seg_lv4"] + ~ ".fnSuffix#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ); } + foreach(m; + (contents_am[cntr].text).matchAll( + rgx.inline_notes_al_regular_number_note) + ) { + debug(endnotes_build) { + writeln( + "{^", mkup.ff_o, m["num"], ".", mkup.ff_c, "^}" + ~ mkup.mark_internal_site_lnk, + tag_in_seg["seg_lv4"], + ".fnSuffix#noteref_\n ", m["num"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) + } + // you need anchor for segments at this point -> + object_notes["anchor"] ~= "note_" ~ m["num"] ~ "』"; + object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) + ? (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["num"]) ~ " " + ~ m["note"] ~ "』" + ) + : (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["num"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + ~ mkup.mark_internal_site_lnk + ~ tag_in_seg["seg_lv4"] + ~ ".fnSuffix#noteref_" + ~ m["num"]) ~ " " + ~ m["note"] ~ "』" + ); + } + return object_notes; +} #+END_SRC ****** gathered notes -#+NAME: meta_emitters_endnotes_2 +#+NAME: meta_emitters_endnotes_function_gathered_notes #+BEGIN_SRC d - @safe private auto gathered_notes() { - string[][string] endnotes_; - if (object_notes.length > 1) { - endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; - endnotes_["anchor"] = (object_notes["anchor"].split(rgx.break_string))[0..$-1]; - } else { - endnotes_["notes"] = []; - endnotes_["anchor"] = []; - } - return endnotes_; +@safe private auto gathered_notes() { + string[][string] endnotes_; + if (object_notes.length > 1) { + endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; + endnotes_["anchor"] = (object_notes["anchor"].split(rgx.break_string))[0..$-1]; + } else { + endnotes_["notes"] = []; + endnotes_["anchor"] = []; } + return endnotes_; +} #+END_SRC ****** endnote objects -#+NAME: meta_emitters_endnotes_3 +#+NAME: meta_emitters_endnotes_function_endnote_objects #+BEGIN_SRC d - @safe private auto endnote_objects(N,O)( - N obj_cite_digits, - O opt_action, - ) { - mixin spineNode; - ObjGenericComposite[] the_endnotes_section; - auto endnotes_ = gathered_notes(); - string type_is; - string lev, lev_markup_number, lev_collapsed_number; - string attrib; - int[string] indent; - ObjGenericComposite comp_obj_heading_; - if ((endnotes_["notes"].length > 0) - && (opt_action.backmatter && opt_action.section_endnotes)) { - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "endnotes"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Endnotes"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = false; - comp_obj_heading_.metainfo.object_number_off = false; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = "endnotes"; - comp_obj_heading_.tags.anchor_tags = ["section_endnotes"]; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_endnotes_section ~= comp_obj_heading_; - 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; - ++mkn; - } - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "endnotes"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Endnotes"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; - comp_obj_heading_.metainfo.heading_lev_markup = 4; - comp_obj_heading_.metainfo.heading_lev_collapsed = 2; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.tags.anchor_tags = ["endnotes"]; - the_endnotes_section ~= comp_obj_heading_; - 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; - ++mkn; - } - } else { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there are no Endnotes"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_endnotes_section ~= comp_obj_heading_; - } - if (opt_action.backmatter && opt_action.section_endnotes) { - ObjGenericComposite comp_obj_endnote_; - comp_obj_endnote_ = comp_obj_endnote_.init; - comp_obj_endnote_.metainfo.is_of_part = "backmatter"; - comp_obj_endnote_.metainfo.is_of_section = "endnotes"; - comp_obj_endnote_.metainfo.is_of_type = "para"; - comp_obj_endnote_.metainfo.is_a = "endnote"; - comp_obj_endnote_.metainfo.ocn = 0; - comp_obj_endnote_.metainfo.identifier = ""; - // comp_obj_heading_.metainfo.dummy_heading = false; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_endnote_.attrib.indent_hang = 0; - comp_obj_endnote_.attrib.indent_base = 0; - comp_obj_endnote_.attrib.bullet = false; - foreach (i, endnote; endnotes_["notes"]) { - auto m = endnote.matchFirst(rgx.note_ref); - string notenumber = m["ref"].to!string; - string anchor_tag = "note_" ~ notenumber; - comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; - comp_obj_endnote_.has.inline_links = true; - comp_obj_endnote_.text = endnote.inline_markup_faces.strip; - the_endnotes_section ~= comp_obj_endnote_; - } - } - auto t = tuple(the_endnotes_section, obj_cite_digits); - return t; - } +@safe private auto endnote_objects(N,O)( + N obj_cite_digits, + O opt_action, +) { + mixin spineNode; + ObjGenericComposite[] the_endnotes_section; + auto endnotes_ = gathered_notes(); + string type_is; + string lev, lev_markup_number, lev_collapsed_number; + string attrib; + int[string] indent; + ObjGenericComposite comp_obj_heading_; + if ((endnotes_["notes"].length > 0) + && (opt_action.backmatter && opt_action.section_endnotes)) { + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "endnotes"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; + comp_obj_heading_.metainfo.object_number_off = false; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "endnotes"; + comp_obj_heading_.tags.anchor_tags = ["section_endnotes"]; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_endnotes_section ~= comp_obj_heading_; + 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + ++mkn; + } + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "endnotes"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Endnotes"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; + comp_obj_heading_.metainfo.heading_lev_markup = 4; + comp_obj_heading_.metainfo.heading_lev_collapsed = 2; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_.tags.anchor_tags = ["endnotes"]; + the_endnotes_section ~= comp_obj_heading_; + 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_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + ++mkn; + } + } else { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there are no Endnotes"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_endnotes_section ~= comp_obj_heading_; + } + if (opt_action.backmatter && opt_action.section_endnotes) { + ObjGenericComposite comp_obj_endnote_; + comp_obj_endnote_ = comp_obj_endnote_.init; + comp_obj_endnote_.metainfo.is_of_part = "backmatter"; + comp_obj_endnote_.metainfo.is_of_section = "endnotes"; + comp_obj_endnote_.metainfo.is_of_type = "para"; + comp_obj_endnote_.metainfo.is_a = "endnote"; + comp_obj_endnote_.metainfo.ocn = 0; + comp_obj_endnote_.metainfo.identifier = ""; + // comp_obj_heading_.metainfo.dummy_heading = false; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_endnote_.attrib.indent_hang = 0; + comp_obj_endnote_.attrib.indent_base = 0; + comp_obj_endnote_.attrib.bullet = false; + foreach (i, endnote; endnotes_["notes"]) { + auto m = endnote.matchFirst(rgx.note_ref); + string notenumber = m["ref"].to!string; + string anchor_tag = "note_" ~ notenumber; + comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; + comp_obj_endnote_.has.inline_links = true; + comp_obj_endnote_.text = endnote.inline_markup_faces.strip; + the_endnotes_section ~= comp_obj_endnote_; + } + } + auto t = tuple(the_endnotes_section, obj_cite_digits); + return t; +} #+END_SRC ***** } -#+NAME: meta_emitters_endnotes_4 +#+NAME: meta_emitters_endnotes_function_close #+BEGIN_SRC d } #+END_SRC @@ -7223,115 +7229,115 @@ struct NotesSection { **** bibliography :bibliography: ***** { biblio struct -#+NAME: meta_emitters_bibliography_0 +#+NAME: meta_emitters_bibliography_function_open #+BEGIN_SRC d struct Bibliography { #+END_SRC ****** biblio -#+NAME: meta_emitters_bibliography_1 +#+NAME: meta_emitters_bibliography_function_biblio_sorted #+BEGIN_SRC d @system public JSONValue[] flow_bibliography_()( - return ref string[] biblio_unsorted_incomplete, - return ref JSONValue[] bib_arr_json - ) { - JSONValue[] biblio_unsorted - = biblio_make_unsorted_array_of_json_objects(biblio_unsorted_incomplete, bib_arr_json); // TODO lookat returns - biblio_arr_json = []; - biblio_unsorted_incomplete = []; - JSONValue[] biblio_sorted__ = biblio_sort(biblio_unsorted); - debug(biblio0) { - biblio_debug(biblio_sorted__); - writeln("---"); - writeln("unsorted incomplete: ", biblio_unsorted_incomplete.length); - writeln("json: ", bib_arr_json.length); - writeln("unsorted: ", biblio_unsorted.length); - writeln("sorted: ", biblio_sorted__.length); - int cntr; - int[7] x; - while (cntr < x.length) { - writeln(cntr, ": ", biblio_sorted__[cntr]["fulltitle"]); - cntr++; - } - } - return biblio_sorted__; - } + return ref string[] biblio_unsorted_incomplete, + return ref JSONValue[] bib_arr_json +) { + JSONValue[] biblio_unsorted + = biblio_make_unsorted_array_of_json_objects(biblio_unsorted_incomplete, bib_arr_json); // TODO lookat returns + biblio_arr_json = []; + biblio_unsorted_incomplete = []; + JSONValue[] biblio_sorted__ = biblio_sort(biblio_unsorted); + debug(biblio0) { + biblio_debug(biblio_sorted__); + writeln("---"); + writeln("unsorted incomplete: ", biblio_unsorted_incomplete.length); + writeln("json: ", bib_arr_json.length); + writeln("unsorted: ", biblio_unsorted.length); + writeln("sorted: ", biblio_sorted__.length); + int cntr; + int[7] x; + while (cntr < x.length) { + writeln(cntr, ": ", biblio_sorted__[cntr]["fulltitle"]); + cntr++; + } + } + return biblio_sorted__; +} #+END_SRC ****** biblio unsorted complete -#+NAME: meta_emitters_bibliography_2 +#+NAME: meta_emitters_bibliography_function_biblio_unsorted_json_object_array #+BEGIN_SRC d - @system final private JSONValue[] biblio_make_unsorted_array_of_json_objects()( - string[] biblio_unordered, - JSONValue[] bib_arr_json - ) { - foreach (bibent; biblio_unordered) { - /+ update bib to include deemed_author, needed for: - sort_bibliography_array_by_deemed_author_year_title - either: sort on multiple fields, or; create such sort field - +/ - JSONValue j = parseJSON(bibent); - if (!empty(j["fulltitle"].str)) { - if (!empty(j["author_raw"].str)) { - j["deemed_author"] = j["author_arr"][0]; - } else if (!empty(j["editor_raw"].str)) { - j["deemed_author"] = j["editor_arr"][0]; - } - j["sortby_deemed_author_year_title"] = ( - j["deemed_author"].str ~ - "; " ~ - j["year"].str ~ - "; " ~ - j["fulltitle"].str - ); - } - bib_arr_json ~= j; +@system final private JSONValue[] biblio_make_unsorted_array_of_json_objects()( + string[] biblio_unordered, + JSONValue[] bib_arr_json +) { + foreach (bibent; biblio_unordered) { + /+ update bib to include deemed_author, needed for: + sort_bibliography_array_by_deemed_author_year_title + either: sort on multiple fields, or; create such sort field + +/ + JSONValue j = parseJSON(bibent); + if (!empty(j["fulltitle"].str)) { + if (!empty(j["author_raw"].str)) { + j["deemed_author"] = j["author_arr"][0]; + } else if (!empty(j["editor_raw"].str)) { + j["deemed_author"] = j["editor_arr"][0]; + } + j["sortby_deemed_author_year_title"] = ( + j["deemed_author"].str ~ + "; " ~ + j["year"].str ~ + "; " ~ + j["fulltitle"].str + ); } - return bib_arr_json.dup; + bib_arr_json ~= j; } + return bib_arr_json.dup; +} #+END_SRC ****** biblio sort -#+NAME: meta_emitters_bibliography_3 -#+BEGIN_SRC d - @system final private JSONValue[] biblio_sort()(JSONValue[] biblio_unordered) { - JSONValue[] biblio_sorted_; - biblio_sorted_ - = sort!((a, b){ - return ((a["sortby_deemed_author_year_title"].str) < (b["sortby_deemed_author_year_title"].str)); - })(biblio_unordered).array; - debug(bibliosorted) { - foreach (j; biblio_sorted_) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } +#+NAME: meta_emitters_bibliography_function_biblio_sort_json +#+BEGIN_SRC d +@system final private JSONValue[] biblio_sort()(JSONValue[] biblio_unordered) { + JSONValue[] biblio_sorted_; + biblio_sorted_ + = sort!((a, b){ + return ((a["sortby_deemed_author_year_title"].str) < (b["sortby_deemed_author_year_title"].str)); + })(biblio_unordered).array; + debug(bibliosorted) { + foreach (j; biblio_sorted_) { + if (!empty(j["fulltitle"].str)) { + writeln(j["sortby_deemed_author_year_title"]); } } - return biblio_sorted_; } + return biblio_sorted_; +} #+END_SRC ****** biblio debug -#+NAME: meta_emitters_bibliography_4 +#+NAME: meta_emitters_bibliography_function_biblio_sorted_json #+BEGIN_SRC d - @system void biblio_debug()(JSONValue[] biblio_sorted) { - debug(biblio0) { - foreach (j; biblio_sorted) { - if (!empty(j["fulltitle"].str)) { - writeln(j["sortby_deemed_author_year_title"]); - } +@system void biblio_debug()(JSONValue[] biblio_sorted) { + debug(biblio0) { + foreach (j; biblio_sorted) { + if (!empty(j["fulltitle"].str)) { + writeln(j["sortby_deemed_author_year_title"]); } } } +} #+END_SRC ***** } -#+NAME: meta_emitters_bibliography_5 +#+NAME: meta_emitters_bibliography_function_close #+BEGIN_SRC d } #+END_SRC @@ -7339,7 +7345,7 @@ struct Bibliography { **** node structure metadata :structure:metadata:node: ***** { metadata node struct -#+NAME: meta_emitters_metadata_0 +#+NAME: meta_emitters_metadata_function_open #+BEGIN_SRC d struct NodeStructureMetadata { int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; @@ -7350,269 +7356,269 @@ struct NodeStructureMetadata { ****** node metadata emitter -#+NAME: meta_emitters_metadata_1 -#+BEGIN_SRC d - @safe ObjGenericComposite node_location_emitter(La,Ta,N)( - string lev_markup_number, - string[string] tag_in_seg, - La lev_anchor_tag, - Ta tag_assoc, - N obj_cite_digits, - int cntr_, - int ptr_, - string is_ - ) { - debug(asserts) { - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } - assert(is_ != "heading"); - assert(obj_cite_digits.object_number.to!int >= 0); - assert(is_ != "heading"); // should not be necessary - assert(obj_cite_digits.object_number.to!int >= 0); // should not be necessary - if (lv7 > eN.bi.off) { - p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; - p_["object_number"] = lv7; - } else if (lv6 > eN.bi.off) { - p_["lev_markup_number"] = DocStructMarkupHeading.h_text_3; - p_["object_number"] = lv6; - } else if (lv5 > eN.bi.off) { - p_["lev_markup_number"] = DocStructMarkupHeading.h_text_2; - p_["object_number"] = lv5; +#+NAME: meta_emitters_metadata_function_node_location +#+BEGIN_SRC d +@safe ObjGenericComposite node_location_emitter(La,Ta,N)( + string lev_markup_number, + string[string] tag_in_seg, + La lev_anchor_tag, + Ta tag_assoc, + N obj_cite_digits, + int cntr_, + int ptr_, + string is_ +) { + debug(asserts) { + static assert(is(typeof(obj_cite_digits.object_number) == int)); + } + assert(is_ != "heading"); + assert(obj_cite_digits.object_number.to!int >= 0); + assert(is_ != "heading"); // should not be necessary + assert(obj_cite_digits.object_number.to!int >= 0); // should not be necessary + if (lv7 > eN.bi.off) { + p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; + p_["object_number"] = lv7; + } else if (lv6 > eN.bi.off) { + p_["lev_markup_number"] = DocStructMarkupHeading.h_text_3; + p_["object_number"] = lv6; + } else if (lv5 > eN.bi.off) { + p_["lev_markup_number"] = DocStructMarkupHeading.h_text_2; + p_["object_number"] = lv5; + } else { + p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; + p_["object_number"] = lv4; + } + ObjGenericComposite comp_obj_location; + comp_obj_location = comp_obj_location.init; + comp_obj_location.metainfo.is_a = is_; + comp_obj_location.metainfo.ocn = obj_cite_digits.object_number; + comp_obj_location.metainfo.identifier = obj_cite_digits.identifier; + comp_obj_location.tags.anchor_tag_html = tag_in_seg["seg_lv4"]; + comp_obj_location.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; + comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag; + comp_obj_location.metainfo.parent_ocn = p_["object_number"]; + comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; + debug(_node) { + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("x ", _node.to!string); } else { - p_["lev_markup_number"] = DocStructMarkupHeading.h_text_1; - p_["object_number"] = lv4; - } - ObjGenericComposite comp_obj_location; - comp_obj_location = comp_obj_location.init; - comp_obj_location.metainfo.is_a = is_; - comp_obj_location.metainfo.ocn = obj_cite_digits.object_number; - comp_obj_location.metainfo.identifier = obj_cite_digits.identifier; - comp_obj_location.tags.anchor_tag_html = tag_in_seg["seg_lv4"]; - comp_obj_location.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; - comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag; - comp_obj_location.metainfo.parent_ocn = p_["object_number"]; - comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; - debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("x ", _node.to!string); - } else { - writeln("- ", _node.to!string); - } + writeln("- ", _node.to!string); } - assert(comp_obj_location.metainfo.parent_lev_markup >= 4); - assert(comp_obj_location.metainfo.parent_lev_markup <= 7); - assert(comp_obj_location.metainfo.parent_ocn >= 0); - return comp_obj_location; - } - invariant() { } + assert(comp_obj_location.metainfo.parent_lev_markup >= 4); + assert(comp_obj_location.metainfo.parent_lev_markup <= 7); + assert(comp_obj_location.metainfo.parent_ocn >= 0); + return comp_obj_location; +} +invariant() { +} #+END_SRC ****** node metadata emitter heading, (including most segnames & their pointers) -#+NAME: meta_emitters_metadata_2 -#+BEGIN_SRC d - @safe ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)( - string _text, - string lev_markup_number, - string lev_collapsed_number, - Hd dummy_heading_status, - string[string] tag_in_seg, - TaL lev_anchor_tag, - TA tag_assoc, - N obj_cite_digits, - int cntr_, - int ptr_, - string[] lv_ancestors_txt, - string is_, - int html_segnames_ptr, - fNr flag_notes_reg, - fNs flag_notes_star, - fL flag_links, - ) { - debug(asserts) { - static assert(is(typeof(lev) == string)); - static assert(is(typeof(obj_cite_digits.object_number) == int)); - } - assert(is_ == "heading"); - assert((obj_cite_digits.object_number).to!int >= 0); - assert( - lev_markup_number.match(rgx.levels_numbered), - ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digits.object_number.to!string) - ); - if (lev_markup_number.match(rgx.levels_numbered)) { - if (lev_markup_number.to!int == 0) { - /+ TODO first hit (of two) with this assertion failure, check, fix & reinstate - assert(obj_cite_digits.object_number.to!int == 1, - "ERROR header lev markup number is: " ~ - lev_markup_number.to!string ~ - " obj_cite_digits.object_number.to!int should == 1 but is: " ~ - obj_cite_digits.object_number.to!string ~ - "\n" ~ _text); - +/ - } - } - switch (lev_markup_number.to!int) { - case 0: - lv = DocStructMarkupHeading.h_sect_A; - lv0 = obj_cite_digit; - lv1 = 0; lv2 = 0; lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; - p_["lev_markup_number"] = 0; - p_["object_number"] = 0; - break; - case 1: - lv = DocStructMarkupHeading.h_sect_B; - lv1 = obj_cite_digit; - lv2 = 0; lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; +#+NAME: meta_emitters_metadata_function_heading +#+BEGIN_SRC d +@safe ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)( + string _text, + string lev_markup_number, + string lev_collapsed_number, + Hd dummy_heading_status, + string[string] tag_in_seg, + TaL lev_anchor_tag, + TA tag_assoc, + N obj_cite_digits, + int cntr_, + int ptr_, + string[] lv_ancestors_txt, + string is_, + int html_segnames_ptr, + fNr flag_notes_reg, + fNs flag_notes_star, + fL flag_links, +) { + debug(asserts) { + static assert(is(typeof(lev) == string)); + static assert(is(typeof(obj_cite_digits.object_number) == int)); + } + assert(is_ == "heading"); + assert((obj_cite_digits.object_number).to!int >= 0); + assert( + lev_markup_number.match(rgx.levels_numbered), + ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digits.object_number.to!string) + ); + if (lev_markup_number.match(rgx.levels_numbered)) { + if (lev_markup_number.to!int == 0) { + /+ TODO first hit (of two) with this assertion failure, check, fix & reinstate + assert(obj_cite_digits.object_number.to!int == 1, + "ERROR header lev markup number is: " ~ + lev_markup_number.to!string ~ + " obj_cite_digits.object_number.to!int should == 1 but is: " ~ + obj_cite_digits.object_number.to!string ~ + "\n" ~ _text); + +/ + } + } + switch (lev_markup_number.to!int) { + case 0: + lv = DocStructMarkupHeading.h_sect_A; + lv0 = obj_cite_digit; + lv1 = 0; lv2 = 0; lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; + p_["lev_markup_number"] = 0; + p_["object_number"] = 0; + break; + case 1: + lv = DocStructMarkupHeading.h_sect_B; + lv1 = obj_cite_digit; + lv2 = 0; lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_sect_A; + p_["object_number"] = lv0; + break; + case 2: + lv = DocStructMarkupHeading.h_sect_C; + lv2 = obj_cite_digit; + lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_sect_B; + p_["object_number"] = lv1; + break; + case 3: + lv = DocStructMarkupHeading.h_sect_D; + lv3 = obj_cite_digit; + lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_sect_C; + p_["object_number"] = lv2; + break; + case 4: + lv = DocStructMarkupHeading.h_text_1; + lv4 = obj_cite_digit; + lv5 = 0; lv6 = 0; lv7 = 0; + if (lv3 > eN.bi.off) { p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_A; - p_["object_number"] = lv0; - break; - case 2: - lv = DocStructMarkupHeading.h_sect_C; - lv2 = obj_cite_digit; - lv3 = 0; lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; - p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_B; - p_["object_number"] = lv1; - break; - case 3: - lv = DocStructMarkupHeading.h_sect_D; - lv3 = obj_cite_digit; - lv4 = 0; lv5 = 0; lv6 = 0; lv7 = 0; + = DocStructMarkupHeading.h_sect_D; + p_["object_number"] = lv3; + } else if (lv2 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_sect_C; p_["object_number"] = lv2; - break; - case 4: - lv = DocStructMarkupHeading.h_text_1; - lv4 = obj_cite_digit; - lv5 = 0; lv6 = 0; lv7 = 0; - if (lv3 > eN.bi.off) { - p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_D; - p_["object_number"] = lv3; - } else if (lv2 > eN.bi.off) { - p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_C; - p_["object_number"] = lv2; - } else if (lv1 > eN.bi.off) { - p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_B; - p_["object_number"] = lv1; - } else { - p_["lev_markup_number"] - = DocStructMarkupHeading.h_sect_A; - p_["object_number"] = lv0; - } - break; - case 5: - lv = DocStructMarkupHeading.h_text_2; - lv5 = obj_cite_digit; - lv6 = 0; lv7 = 0; - p_["lev_markup_number"] - = DocStructMarkupHeading.h_text_1; - p_["object_number"] = lv4; - break; - case 6: - lv = DocStructMarkupHeading.h_text_3; - lv6 = obj_cite_digit; - lv7 = 0; + } else if (lv1 > eN.bi.off) { p_["lev_markup_number"] - = DocStructMarkupHeading.h_text_2; - p_["object_number"] = lv5; - break; - case 7: - lv = DocStructMarkupHeading.h_text_4; - lv7 = obj_cite_digit; + = DocStructMarkupHeading.h_sect_B; + p_["object_number"] = lv1; + } else { p_["lev_markup_number"] - = DocStructMarkupHeading.h_text_3; - p_["object_number"] = lv6; - break; - default: - break; + = DocStructMarkupHeading.h_sect_A; + p_["object_number"] = lv0; } - ObjGenericComposite _comp_obj_heading_; - _comp_obj_heading_ = _comp_obj_heading_.init; - _comp_obj_heading_.metainfo.is_of_part = "body"; - _comp_obj_heading_.metainfo.is_of_section = "body"; - _comp_obj_heading_.metainfo.is_of_type = "para"; - _comp_obj_heading_.metainfo.is_a = "heading"; - _comp_obj_heading_.text = _text.to!string.strip; - _comp_obj_heading_.metainfo.ocn = obj_cite_digits.object_number; - _comp_obj_heading_.metainfo.identifier = obj_cite_digits.identifier; - _comp_obj_heading_.metainfo.dummy_heading = (dummy_heading_status == "t") ? true: false; - _comp_obj_heading_.metainfo.object_number_off = obj_cite_digits.off; - // _comp_obj_heading_.metainfo.o_n_book_index = obj_cite_digits.bkidx; - _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; - _comp_obj_heading_.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; - _comp_obj_heading_.tags.anchor_tag_html = tag_in_seg["seg_lv4"]; - _comp_obj_heading_.tags.in_segment_html = _comp_obj_heading_.tags.anchor_tag_html; - _comp_obj_heading_.tags.heading_lev_anchor_tag = lev_anchor_tag; - _comp_obj_heading_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; - _comp_obj_heading_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; - _comp_obj_heading_.metainfo.heading_lev_markup = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); - _comp_obj_heading_.metainfo.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? lev_collapsed_number.to!int : 0); - _comp_obj_heading_.metainfo.parent_ocn = p_["object_number"]; - _comp_obj_heading_.metainfo.parent_lev_markup = p_["lev_markup_number"]; - _comp_obj_heading_.tags.heading_ancestors_text = lv_ancestors_txt; - _comp_obj_heading_.ptr.doc_object = cntr_; - _comp_obj_heading_.ptr.html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0); - _comp_obj_heading_.ptr.heading = ptr_; - _comp_obj_heading_.has.inline_notes_reg = flag_notes_reg; - _comp_obj_heading_.has.inline_notes_star = flag_notes_star; - _comp_obj_heading_.has.inline_links = flag_links; - 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_lv1_to_4"] = _comp_obj_heading_.tags.segment_anchor_tag_epub; - debug(_node) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } - } - debug(nodeheading) { - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - writeln("* ", _node.to!string); - } - } - assert(_comp_obj_heading_.metainfo.parent_lev_markup <= 7); - assert(_comp_obj_heading_.metainfo.parent_ocn >= 0); - if (lev_markup_number.match(rgx.levels_numbered_headings)) { - assert(_comp_obj_heading_.metainfo.heading_lev_markup <= 7); - assert(_comp_obj_heading_.metainfo.ocn >= 0); - if (_comp_obj_heading_.metainfo.parent_lev_markup > 0) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup < _comp_obj_heading_.metainfo.heading_lev_markup); - if (_comp_obj_heading_.metainfo.ocn != 0) { - assert(_comp_obj_heading_.metainfo.parent_ocn < _comp_obj_heading_.metainfo.ocn); - } - } - if (_comp_obj_heading_.metainfo.heading_lev_markup == 0) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_A); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_B) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_A); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_C) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_B); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_D) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_C); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_1) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup <= DocStructMarkupHeading.h_sect_D); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_2) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_1); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_3) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_2); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_4) { - assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_3); - } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_5) { - } - } - return _comp_obj_heading_; + break; + case 5: + lv = DocStructMarkupHeading.h_text_2; + lv5 = obj_cite_digit; + lv6 = 0; lv7 = 0; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_text_1; + p_["object_number"] = lv4; + break; + case 6: + lv = DocStructMarkupHeading.h_text_3; + lv6 = obj_cite_digit; + lv7 = 0; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_text_2; + p_["object_number"] = lv5; + break; + case 7: + lv = DocStructMarkupHeading.h_text_4; + lv7 = obj_cite_digit; + p_["lev_markup_number"] + = DocStructMarkupHeading.h_text_3; + p_["object_number"] = lv6; + break; + default: + break; } - invariant() { + ObjGenericComposite _comp_obj_heading_; + _comp_obj_heading_ = _comp_obj_heading_.init; + _comp_obj_heading_.metainfo.is_of_part = "body"; + _comp_obj_heading_.metainfo.is_of_section = "body"; + _comp_obj_heading_.metainfo.is_of_type = "para"; + _comp_obj_heading_.metainfo.is_a = "heading"; + _comp_obj_heading_.text = _text.to!string.strip; + _comp_obj_heading_.metainfo.ocn = obj_cite_digits.object_number; + _comp_obj_heading_.metainfo.identifier = obj_cite_digits.identifier; + _comp_obj_heading_.metainfo.dummy_heading = (dummy_heading_status == "t") ? true: false; + _comp_obj_heading_.metainfo.object_number_off = obj_cite_digits.off; + // _comp_obj_heading_.metainfo.o_n_book_index = obj_cite_digits.bkidx; + _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; + _comp_obj_heading_.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; + _comp_obj_heading_.tags.anchor_tag_html = tag_in_seg["seg_lv4"]; + _comp_obj_heading_.tags.in_segment_html = _comp_obj_heading_.tags.anchor_tag_html; + _comp_obj_heading_.tags.heading_lev_anchor_tag = lev_anchor_tag; + _comp_obj_heading_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + _comp_obj_heading_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + _comp_obj_heading_.metainfo.heading_lev_markup = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); + _comp_obj_heading_.metainfo.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? lev_collapsed_number.to!int : 0); + _comp_obj_heading_.metainfo.parent_ocn = p_["object_number"]; + _comp_obj_heading_.metainfo.parent_lev_markup = p_["lev_markup_number"]; + _comp_obj_heading_.tags.heading_ancestors_text = lv_ancestors_txt; + _comp_obj_heading_.ptr.doc_object = cntr_; + _comp_obj_heading_.ptr.html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0); + _comp_obj_heading_.ptr.heading = ptr_; + _comp_obj_heading_.has.inline_notes_reg = flag_notes_reg; + _comp_obj_heading_.has.inline_notes_star = flag_notes_star; + _comp_obj_heading_.has.inline_links = flag_links; + 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_lv1_to_4"] = _comp_obj_heading_.tags.segment_anchor_tag_epub; + debug(_node) { + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("* ", _node.to!string); + } } + debug(nodeheading) { + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + writeln("* ", _node.to!string); + } + } + assert(_comp_obj_heading_.metainfo.parent_lev_markup <= 7); + assert(_comp_obj_heading_.metainfo.parent_ocn >= 0); + if (lev_markup_number.match(rgx.levels_numbered_headings)) { + assert(_comp_obj_heading_.metainfo.heading_lev_markup <= 7); + assert(_comp_obj_heading_.metainfo.ocn >= 0); + if (_comp_obj_heading_.metainfo.parent_lev_markup > 0) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup < _comp_obj_heading_.metainfo.heading_lev_markup); + if (_comp_obj_heading_.metainfo.ocn != 0) { + assert(_comp_obj_heading_.metainfo.parent_ocn < _comp_obj_heading_.metainfo.ocn); + } + } + if (_comp_obj_heading_.metainfo.heading_lev_markup == 0) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_B) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_A); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_C) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_B); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_sect_D) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_sect_C); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_1) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup <= DocStructMarkupHeading.h_sect_D); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_2) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_1); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_3) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_2); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_4) { + assert(_comp_obj_heading_.metainfo.parent_lev_markup == DocStructMarkupHeading.h_text_3); + } else if (_comp_obj_heading_.metainfo.heading_lev_markup == DocStructMarkupHeading.h_text_5) { + } + } + return _comp_obj_heading_; +} +invariant() { +} #+END_SRC ***** } -#+NAME: meta_emitters_metadata_3 +#+NAME: meta_emitters_metadata_function_close #+BEGIN_SRC d } #+END_SRC @@ -7839,16 +7845,16 @@ set abstracted objects for downstream processing module doc_reform.meta.metadoc_object_setter; template ObjectSetter() { /+ structs +/ - <> - <> - <> - <> - <> - <> - <> - <> - <> - <> + <> + <> + <> + <> + <> + <> + <> + <> + <> + <> } #+END_SRC @@ -7869,7 +7875,7 @@ struct HeadingAttrib { *** _composite object_ [#A] -#+NAME: meta_structs_init_0 +#+NAME: meta_structs_init_docObj_metainfo #+BEGIN_SRC d struct DocObj_MetaInfo_ { string is_of_part = ""; // frontmatter, body, backmatter @@ -7948,7 +7954,7 @@ struct DocObj_MetaInfo_ { **** object text attributes -#+NAME: meta_structs_init_1 +#+NAME: meta_structs_init_docObj_txtAttrib #+BEGIN_SRC d struct DocObj_TxtAttrib_ { int indent_base = 0; @@ -7960,7 +7966,7 @@ struct DocObj_TxtAttrib_ { **** object has within it -#+NAME: meta_structs_init_2 +#+NAME: meta_structs_init_docObj_has #+BEGIN_SRC d struct DocObj_Has_ { bool inline_links = false; @@ -7973,7 +7979,7 @@ struct DocObj_Has_ { **** table attributes -#+NAME: meta_structs_init_3 +#+NAME: meta_structs_init_docObj_table #+BEGIN_SRC d struct DocObj_Table_ { int number_of_columns = 0; @@ -7986,7 +7992,7 @@ struct DocObj_Table_ { **** code attributes -#+NAME: meta_structs_init_4 +#+NAME: meta_structs_init_docObj_code_block #+BEGIN_SRC d struct DocObj_CodeBlock_ { string syntax = ""; @@ -7996,7 +8002,7 @@ struct DocObj_CodeBlock_ { **** stow (things to be protected from regular text transformations, so far links) -#+NAME: meta_structs_init_5 +#+NAME: meta_structs_init_docObj_stow #+BEGIN_SRC d struct DocObj_Stow_ { string[] link = []; @@ -8005,7 +8011,7 @@ struct DocObj_Stow_ { **** pointers -#+NAME: meta_structs_init_6 +#+NAME: meta_structs_init_docObj_pointer #+BEGIN_SRC d struct DocObj_Pointer_ { int doc_object = 0; @@ -8016,7 +8022,7 @@ struct DocObj_Pointer_ { **** tags -#+NAME: meta_structs_init_7 +#+NAME: meta_structs_init_docObj_tags #+BEGIN_SRC d struct DocObj_Tags_ { string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; @@ -8035,7 +8041,7 @@ struct DocObj_Tags_ { **** composite object the parts -#+NAME: meta_structs_init_8 +#+NAME: meta_structs_init_docObj_composite #+BEGIN_SRC d struct ObjGenericComposite { string text = ""; @@ -8052,7 +8058,7 @@ struct ObjGenericComposite { *** The Objects: generic composite object array -#+NAME: meta_structs_init_9 +#+NAME: meta_structs_init_docObj_theObjects #+BEGIN_SRC d struct TheObjects { ObjGenericComposite[] oca; -- cgit v1.2.3