aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/meta/metadoc_from_src_functions.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/meta/metadoc_from_src_functions.d')
-rw-r--r--src/sisudoc/meta/metadoc_from_src_functions.d243
1 files changed, 232 insertions, 11 deletions
diff --git a/src/sisudoc/meta/metadoc_from_src_functions.d b/src/sisudoc/meta/metadoc_from_src_functions.d
index 953e75a..63143e9 100644
--- a/src/sisudoc/meta/metadoc_from_src_functions.d
+++ b/src/sisudoc/meta/metadoc_from_src_functions.d
@@ -6,7 +6,7 @@
- Author: Ralph Amissah
[ralph.amissah@gmail.com]
- - Copyright: (C) 2015 - 2024 Ralph Amissah, All Rights Reserved.
+ - Copyright: (C) 2015 - 2025 Ralph Amissah, All Rights Reserved.
- License: AGPL 3 or later:
@@ -453,6 +453,62 @@ template docAbstractionFunctions() {
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_quotemarks_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(codequotemarks) { writefln( "* [code quotemarks] %s", line); }
+ pith["block_is"] = eN.blk_is.code;
+ pith["block_state"] = eN.blk_state.on;
+ pith["block_delim"] = eN.blk_delim.quotemarks; //
+ } else if (auto m = line.matchFirst(rgx.block_quotemarks_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 quotemarks] %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.quotemarks; //
+ pith["verse_new"] = eN.bi.on;
+ } else if (auto m = line.matchFirst(rgx.block_quotemarks_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 quotemarks] %s", line); }
+ pith["block_is"] = eN.blk_is.group;
+ pith["block_state"] = eN.blk_state.on;
+ pith["block_delim"] = eN.blk_delim.quotemarks;
+ } else if (auto m = line.matchFirst(rgx.block_quotemarks_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 quotemarks] %s", line); }
+ pith["block_is"] = eN.blk_is.block;
+ pith["block_state"] = eN.blk_state.on;
+ pith["block_delim"] = eN.blk_delim.quotemarks;
+ } else if (auto m = line.matchFirst(rgx.block_quotemarks_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 quotemarks] %s", line); // quote (quotemarks) open
+ }
+ pith["block_is"] = eN.blk_is.quote;
+ pith["block_state"] = eN.blk_state.on;
+ pith["block_delim"] = eN.blk_delim.quotemarks;
+ } else if (auto m = line.matchFirst(rgx.block_quotemarks_table_open)) { // quotemarks table open
+ debug(table) { writefln( "* [table quotemarks] %s", line); }
+ dochas["table"] ++;
+ an_object["table_head"] = m["attrib"].to!string;
+ an_object["block_type"] = "quotemarks";
+ pith["block_is"] = eN.blk_is.table;
+ pith["block_state"] = eN.blk_state.on;
+ pith["block_delim"] = eN.blk_delim.quotemarks;
} else if (auto m = line.matchFirst(rgx.block_tic_code_open)) {
dochas["codeblock"]++;
an_object["lang"] = "";
@@ -536,6 +592,17 @@ template docAbstractionFunctions() {
debug(group) { writeln(line); }
an_object[an_object_key] ~= line ~= "\n";
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (line.matchFirst(rgx.block_quotemarks_close)) {
+ debug(group) { writeln(line); }
+ an_object[an_object_key] = an_object[an_object_key].stripRight;
+ pith["block_is"] = eN.blk_is.group;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ debug(group) { writeln(line); }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(group) { writeln(line); }
@@ -574,6 +641,17 @@ template docAbstractionFunctions() {
debug(block) { writeln(line); }
an_object[an_object_key] ~= line ~= "\n";
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (line.matchFirst(rgx.block_quotemarks_close)) {
+ debug(block) { writeln(line); }
+ an_object[an_object_key] = an_object[an_object_key].stripRight;
+ pith["block_is"] = eN.blk_is.block;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ debug(block) { writeln(line); }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(block) { writeln(line); }
@@ -698,6 +776,94 @@ template docAbstractionFunctions() {
++cntr;
}
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (auto m = line.matchFirst(rgx.block_quotemarks_close)) {
+ an_object[an_object_key] = "verse";
+ debug(poem) { writefln( "* [poem quotemarks] %s", line); }
+ if (processing.length > 0) {
+ an_object[an_object_key] = processing["verse"];
+ }
+ if (an_object.length > 0) {
+ debug(poem) { writeln(__LINE__); writeln(obj_cite_digits.object_number, line); }
+ processing.remove("verse");
+ an_object["is"] = "verse";
+ ST_txtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_struct
+ = 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_struct.obj_txt;
+ anchor_tag = substantive_obj_misc_struct.anchor_tag;
+ comp_obj_ = set_object_generic("body", "body", "block", "verse", an_object["substantive"], obj_cite_digits.object_number);
+ comp_obj_.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_.metainfo.object_number_off = obj_cite_digits.off;
+ comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx;
+ comp_obj_.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
+ comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"];
+ comp_obj_.has.inline_notes_reg = substantive_obj_misc_struct.has_notes_reg;
+ comp_obj_.has.inline_notes_star = substantive_obj_misc_struct.has_notes_star;
+ comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links;
+ the_document_body_section ~= comp_obj_;
+ tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
+ object_number_poem["end"] = obj_cite_digits.object_number.to!string;
+ object_reset(an_object);
+ processing.remove("verse");
+ ++cntr;
+ }
+ pith["block_is"] = eN.blk_is.poem;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ processing["verse"] ~= line ~= "\n";
+ if (pith["verse_new"] == eN.bi.on) {
+ obj_cite_digits = ocn_emit(pith["ocn"]);
+ pith["verse_new"] = eN.bi.off;
+ } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {
+ processing["verse"] = processing["verse"].stripRight;
+ pith["verse_new"] = eN.bi.on;
+ verse_line = eN.bi.off;
+ }
+ if (pith["verse_new"] == eN.bi.on) {
+ verse_line = 1;
+ an_object[an_object_key] = processing["verse"];
+ debug(poem) { writefln(
+ "* %s tic\n%s",
+ obj_cite_digits.object_number,
+ an_object[an_object_key]
+ );
+ }
+ processing.remove("verse");
+ 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"]
+ );
+ ST_txtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_struct
+ = 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_struct.obj_txt;
+ anchor_tag = substantive_obj_misc_struct.anchor_tag;
+ comp_obj_ = set_object_generic("body", "body", "block", "verse", an_object["substantive"], obj_cite_digits.object_number);
+ comp_obj_.metainfo.identifier = obj_cite_digits.identifier;
+ comp_obj_.metainfo.object_number_off = obj_cite_digits.off;
+ comp_obj_.metainfo.o_n_book_index = obj_cite_digits.bkidx;
+ comp_obj_.metainfo.object_number_type = obj_cite_digits.type;
+ comp_obj_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"];
+ comp_obj_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1to4"];
+ comp_obj_.has.inline_notes_reg = substantive_obj_misc_struct.has_notes_reg;
+ comp_obj_.has.inline_notes_star = substantive_obj_misc_struct.has_notes_star;
+ comp_obj_.has.inline_links = substantive_obj_misc_struct.has_links;
+ the_document_body_section ~= comp_obj_;
+ tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc);
+ object_reset(an_object);
+ processing.remove("verse");
+ ++cntr;
+ }
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (auto m = line.matchFirst(rgx.block_tic_close)) {
an_object[an_object_key] = "verse";
@@ -816,6 +982,19 @@ template docAbstractionFunctions() {
debug(codecurly) { writeln(line); }
an_object[an_object_key] ~= line ~= "\n";
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (line.matchFirst(rgx.block_quotemarks_close)) {
+ debug(codequotemarks) { writeln(line); }
+ an_object[an_object_key] = an_object[an_object_key]
+ .replaceFirst(rgx.newline_eol_delimiter_only, "")
+ .stripRight;
+ pith["block_is"] = eN.blk_is.code;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ debug(codequotemarks) { writeln(line); }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(codetic) { writeln(line); }
@@ -884,6 +1063,16 @@ template docAbstractionFunctions() {
debug(table) { writeln(line); }
an_object[an_object_key] ~= line ~= "\n";
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (line.matchFirst(rgx.block_quotemarks_close)) {
+ debug(table) { writeln(line); }
+ pith["block_is"] = eN.blk_is.table;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ debug(table) { writeln(line); }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(table) { writeln(line); }
@@ -927,6 +1116,17 @@ template docAbstractionFunctions() {
debug(quote) { writeln(line); }
an_object[an_object_key] ~= line ~= "\n";
}
+ } else if (pith["block_delim"] == eN.blk_delim.quotemarks) {
+ if (line.matchFirst(rgx.block_quotemarks_close)) {
+ debug(quote) { writeln(line); }
+ an_object[an_object_key] = an_object[an_object_key].stripRight;
+ pith["block_is"] = eN.blk_is.quote;
+ pith["block_state"] = eN.blk_state.closing;
+ pith["block_delim"] = eN.blk_delim.off;
+ } else {
+ debug(quote) { writeln(line); }
+ an_object[an_object_key] ~= line ~= "\n";
+ }
} else if (pith["block_delim"] == eN.blk_delim.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
debug(quote) { writeln(line); }
@@ -2357,10 +2557,8 @@ template docAbstractionFunctions() {
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;
+ 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 = "";
}
@@ -2379,8 +2577,8 @@ template docAbstractionFunctions() {
|| (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;
+ obj_txt["munge"] = (obj_txt["munge"]).inline_markup_faces;
+ obj_txt["munge"] = (obj_txt["munge"]).links_and_images;
}
switch (obj_["is"]) {
case "heading":
@@ -3099,8 +3297,8 @@ template docAbstractionFunctions() {
// ↓ - endnotes
struct NotesSection {
string[string] object_notes;
- int previous_count;
- int mkn;
+ int previous_count;
+ int mkn;
static auto rgx = RgxI();
private auto gather_notes_for_endnote_section(
ObjGenericComposite[] contents_am,
@@ -3631,7 +3829,7 @@ template docAbstractionFunctions() {
}
} else { // para
{
- auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
{
an_object = _get.this_object;
an_object_key = _get.this_object_key;
@@ -3924,7 +4122,7 @@ template docAbstractionFunctions() {
tag_assoc[comp_obj_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_.tags.segment_anchor_tag_epub;
} else if (!(line.empty)) {
{
- auto _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
+ ST_flow_para_match _get = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur);
{
an_object = _get.this_object;
an_object_key = _get.this_object_key;
@@ -4035,11 +4233,31 @@ template docAbstractionFunctions() {
int html_segnames_ptr_cntr,
int html_segnames_ptr,
) {
+ string[string][string] notes_;
+ if (the_document_body_section.length > 1) {
+ string _notes;
+ foreach (ref obj; the_document_body_section) {
+ if (obj.has.inline_notes_reg) {
+ if ((obj.text).matchFirst(rgx.inline_notes_al_gen)) {
+ foreach (m; (obj.text).matchAll(rgx.inline_notes_al_regular_number_note)) {
+ _notes ~= "\n\n" ~ m["num"] ~ ". " ~ m["note"];
+ notes_[(m["num"])]["ocn"] = obj.metainfo.ocn.to!string;
+ }
+ }
+ }
+ }
+ }
if (the_document_endnotes_section.length > 1) {
segnames["html"] ~= "endnotes";
segnames["epub"] ~= "endnotes";
html_segnames_ptr = html_segnames_ptr_cntr;
foreach (ref obj; the_document_endnotes_section) {
+ auto matches = (obj.text).matchAll(rgx.endnote_section_note);
+ foreach (m; matches) {
+ obj.metainfo.parent_ocn = notes_[(m["notenumber"])]["ocn"].to!int;
+ }
+ }
+ foreach (ref obj; the_document_endnotes_section) {
if (obj.metainfo.is_a == "heading") {
obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup];
}
@@ -5206,6 +5424,9 @@ template docSectKeysSeq() {
string[] latex() {
return document_section_keys_sequenced["latex"];
}
+ string[] text() {
+ return document_section_keys_sequenced["text"];
+ }
}
return doc_sect_keys_seq();
}