aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/meta
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/ocda/meta')
-rw-r--r--src/sisudoc/ocda/meta/metadoc_from_src.d50
-rw-r--r--src/sisudoc/ocda/meta/metadoc_from_src_functions.d12
-rw-r--r--src/sisudoc/ocda/meta/metadoc_object_setter.d6
-rw-r--r--src/sisudoc/ocda/meta/ocn_align.d9
4 files changed, 65 insertions, 12 deletions
diff --git a/src/sisudoc/ocda/meta/metadoc_from_src.d b/src/sisudoc/ocda/meta/metadoc_from_src.d
index 3670a39..cbd25e2 100644
--- a/src/sisudoc/ocda/meta/metadoc_from_src.d
+++ b/src/sisudoc/ocda/meta/metadoc_from_src.d
@@ -148,6 +148,8 @@ template docAbstraction() {
"start" : "",
"end" : ""
];
+ /+ ↓ where the open poem's first verse will go, -1 when no poem is open +/
+ long _poem_open_idx = -1;
string[] lv_ancestors_txt = [ "", "", "", "", "", "", "", "", ];
/+ ↓ dom structure state, per document (not shared, parallel safe) +/
int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,];
@@ -426,6 +428,7 @@ template docAbstraction() {
object_reset(an_object);
processing.remove("verse");
object_number_poem["start"] = obj_cite_digits.object_number.to!string;
+ _poem_open_idx = the_document_body_section.length.to!long;
}
{
ST_txt_by_line_block_start _get = line.txt_by_line_block_start(pith, dochas, object_number_poem);
@@ -602,6 +605,46 @@ template docAbstraction() {
pith = _get.pith;
}
}
+ /+ ↓ poem closed: poem object has been appended after its last verse.
+ It is a container, not a citable unit - its verses are - so it
+ carries no ocn of its own and states the range of its verses
+ instead, and it goes to the head of them, so that a writer
+ meeting it knows what follows and where it ends, and can wrap the
+ verses in one pass. (an issue with a note in the last verse of a
+ poem has been addressed)
+ +/
+ if (_poem_open_idx >= 0
+ && the_document_body_section.length > _poem_open_idx + 1
+ && the_document_body_section[$-1].metainfo.is_a == "poem"
+ ) {
+ size_t _s = _poem_open_idx.to!size_t;
+ size_t _p = the_document_body_section.length - 1;
+ size_t _first = _s;
+ while (_first < _p && the_document_body_section[_first].metainfo.is_a != "verse") { ++_first; }
+ size_t _last = _p;
+ while (_last > _s && the_document_body_section[_last - 1].metainfo.is_a != "verse") { --_last; }
+ if (_first < _p && _last > _s) {
+ --_last;
+ if ((the_document_body_section[_last].text).match(rgx.inline_notes_al_all_note)) {
+ object_notes = note_section.gather_notes_for_endnote_section(
+ the_document_body_section,
+ tag_in_seg,
+ (_last).to!int,
+ );
+ }
+ auto _poem = the_document_body_section[_p];
+ _poem.metainfo.ocn_range_first = the_document_body_section[_first].metainfo.ocn;
+ _poem.metainfo.ocn_range_last = the_document_body_section[_last].metainfo.ocn;
+ _poem.tags.html_segment_anchor_tag_is = the_document_body_section[_first].tags.html_segment_anchor_tag_is;
+ _poem.tags.epub_segment_anchor_tag_is = the_document_body_section[_first].tags.epub_segment_anchor_tag_is;
+ the_document_body_section
+ = the_document_body_section[0 .. _s]
+ ~ _poem
+ ~ the_document_body_section[_s .. _p];
+ previous_length = the_document_body_section.length.to!int;
+ }
+ _poem_open_idx = -1;
+ }
} else {
// line.empty, post contents, empty variables:
assert(
@@ -1031,12 +1074,13 @@ template docAbstraction() {
= obj.tags.html_segment_anchor_tag_is;
}
/+ ↓ An object that is not written into any segment still carries an
- identifier, and can share it: a poem block and its verses have one
- ocn between them, the verses are written and the block itself is not.
+ identifier, and could share it: a poem block carried the ocn of its last
+ verse until 2.1, and the verses are written where the block is not.
The block comes second, so an unguarded assignment replaced a good
segment name with an empty one, and the link came out as
".xhtml#297". seg_lv4 above is guarded already, which is why this
- showed in the epub and not in the html.
+ showed in the epub and not in the html. Since 2.1 the poem has no
+ identifier; the guard stays, for any object that is not in a segment.
+/
if (!(obj.tags.epub_segment_anchor_tag_is.empty)) {
tag_assoc[(obj.metainfo.identifier)]["seg_lv1to4"]
diff --git a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
index 922f389..fc12087 100644
--- a/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
+++ b/src/sisudoc/ocda/meta/metadoc_from_src_functions.d
@@ -2163,11 +2163,13 @@ template docAbstractionFunctions() {
heading_ptr-1,
an_object["is"]
);
- comp_obj_poem_ocn = set_object_generic("body", "body", "block", "poem", "", 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;
+ /+ ↓ the poem: a container of the verses just written, not a citable unit
+ on its own, it now states the range of its verses
+ (ocn_range_first/_last), (it previously carried the last verse's ocn
+ and identifier, one number occurring on two objects)
+ +/
+ comp_obj_poem_ocn = set_object_generic("body", "body", "block", "poem", "", 0);
+ comp_obj_poem_ocn.metainfo.identifier = "";
the_document_body_section ~= comp_obj_poem_ocn;
pith["block_is"] = eN.blk_is.poem;
pith["block_state"] = eN.blk_state.off;
diff --git a/src/sisudoc/ocda/meta/metadoc_object_setter.d b/src/sisudoc/ocda/meta/metadoc_object_setter.d
index 6c090db..eff01a2 100644
--- a/src/sisudoc/ocda/meta/metadoc_object_setter.d
+++ b/src/sisudoc/ocda/meta/metadoc_object_setter.d
@@ -230,6 +230,12 @@ template ObjectSetter() {
int parent_lev_markup = 0;
int parent_ocn = 0;
int last_descendant_ocn = 0;
+ /+ ↓ the objects a container holds, as the first and last of their ocns: a
+ poem is not itself a citable object, its verses are, and it is cited as
+ the range of citable objects, ocn ("173-180"). 0 where not a container.
+ +/
+ int ocn_range_first = 0;
+ int ocn_range_last = 0;
int[] children_headings;
SHA_256_Hashes_ sha256;
}
diff --git a/src/sisudoc/ocda/meta/ocn_align.d b/src/sisudoc/ocda/meta/ocn_align.d
index 9f9fdaf..e93f12a 100644
--- a/src/sisudoc/ocda/meta/ocn_align.d
+++ b/src/sisudoc/ocda/meta/ocn_align.d
@@ -163,10 +163,11 @@ template spineOcnAlign() {
foreach (obj; doc.abstraction[section]) {
int _ocn = obj.metainfo.ocn.to!int;
if (_ocn <= 0) { continue; }
- /+ ↓ first in document order wins. An ocn is not unique: a poem and
- its first verse share one, by design, so the same number names
- two objects and the first of them is the one both languages
- will have reached first.
+ /+ ↓ first in document order wins. Until format spec:2.1 a (verse) ocn
+ was not unique: a poem carried the ocn of its last verse, so the
+ same number named two objects. A poem now carries 0 and is passed
+ over above; the rule stays, and costs nothing, for an artefact
+ written before spec:2.1.
+/
if (_ocn !in _p.kinds) { _p.kinds[_ocn] = _kindOf(obj); }
_p.ocn_count += 1;