diff options
| -rw-r--r-- | org/ocda.org | 26 | ||||
| -rw-r--r-- | src/sisudoc/ocda/meta/metadoc_from_src.d | 26 |
2 files changed, 52 insertions, 0 deletions
diff --git a/org/ocda.org b/org/ocda.org index f84d522..1e9d79e 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -1511,6 +1511,32 @@ ObjGenericComposite[][string] document_the = [ // dom tail only "tail": the_document_xml_dom_tail_section, ]; +/+ ↓ document level counts of inline markup. The block counters + (codeblock, poem, group, block, quote, table) are incremented as the + blocks are recognised; the inline markup is counted here, over the + assembled body objects. The body is counted alone: the endnotes + section is a rendering of the notes the body objects carry inline. + Links: those _links() stowed are counted from stow.link, their place + in the text having been taken by the stow index (a numeric target); + the link markup left in the text (anchors, and urls _links() does + not stow) is counted from the text ++/ +foreach (obj_; document_the["body"]) { + dochas["inline_links"] += obj_.stow.link.length.to!uint; + foreach (m; obj_.text.matchAll(rgx.inline_link)) { + if (!(m["link"].all!(c => (c >= '0' && c <= '9')))) { + ++dochas["inline_links"]; + } + } + foreach (m; obj_.text.matchAll(rgx.inline_notes_al_regular_number_note)) { + ++dochas["inline_notes"]; + } + foreach (m; obj_.text.matchAll(rgx.inline_notes_al_special_char_note)) { + if (m["char"].canFind("*")) { + ++dochas["inline_notes_star"]; + } + } +} // document parts keys as needed string[][string] document_section_keys_sequenced = [ "scroll": ["head", "toc", "body",], diff --git a/src/sisudoc/ocda/meta/metadoc_from_src.d b/src/sisudoc/ocda/meta/metadoc_from_src.d index cae6c25..e104c94 100644 --- a/src/sisudoc/ocda/meta/metadoc_from_src.d +++ b/src/sisudoc/ocda/meta/metadoc_from_src.d @@ -1405,6 +1405,32 @@ template docAbstraction() { // dom tail only "tail": the_document_xml_dom_tail_section, ]; + /+ ↓ document level counts of inline markup. The block counters + (codeblock, poem, group, block, quote, table) are incremented as the + blocks are recognised; the inline markup is counted here, over the + assembled body objects. The body is counted alone: the endnotes + section is a rendering of the notes the body objects carry inline. + Links: those _links() stowed are counted from stow.link, their place + in the text having been taken by the stow index (a numeric target); + the link markup left in the text (anchors, and urls _links() does + not stow) is counted from the text + +/ + foreach (obj_; document_the["body"]) { + dochas["inline_links"] += obj_.stow.link.length.to!uint; + foreach (m; obj_.text.matchAll(rgx.inline_link)) { + if (!(m["link"].all!(c => (c >= '0' && c <= '9')))) { + ++dochas["inline_links"]; + } + } + foreach (m; obj_.text.matchAll(rgx.inline_notes_al_regular_number_note)) { + ++dochas["inline_notes"]; + } + foreach (m; obj_.text.matchAll(rgx.inline_notes_al_special_char_note)) { + if (m["char"].canFind("*")) { + ++dochas["inline_notes_star"]; + } + } + } // document parts keys as needed string[][string] document_section_keys_sequenced = [ "scroll": ["head", "toc", "body",], |
