faustedition / faust-gen-html

Pipelines to generate HTML for the Faust edition's reading texts and prints.
1 stars 4 forks source link

transpose empty elements that span to anchors #627

Open gerritbruening opened 5 years ago

gerritbruening commented 5 years ago

When I have something like

                <transpose f:revType="soon-or-late">
                    <ptr target="#l7172-l7174"/>
                    <ptr target="#l7175-l7177"/>
                </transpose>

and

                                    <milestone xml:id="l7175-l7177" spanTo="#anchor_l7175-l7177" unit="group"/>
                                    <l n="7175">Das Trallern iſt bey mir verloren</l>
                                    <l n="7176">Es krabbelt wohl mir um die Ohren</l>
                                    <l n="7177">Allein zum Herzen dringt es nicht;</l>
                                    <anchor xml:id="anchor_l7175-l7177"/>
                                    <milestone xml:id="l7172-l7174" spanTo="#anchor_l7172-l7174" unit="group"/>
                                    <l n="7172">Das ſind die ſaubern Neuigkeiten</l>
                                    <l n="7173">Wo aus der Kehle, von den Saiten,</l>
                                    <l n="7174">Ein Ton ſich um den andern flicht.</l>
                                    <anchor xml:id="anchor_l7172-l7174"/>

the transposition for last stage doesn't work. @thvitt, can you find out how often we have transpose that points to a milestone?

gerritbruening commented 5 years ago

Oh, pointer point to anchor, that's bad.

thvitt commented 5 years ago

Transposed empty elements

Sigil with Transposition ID of transposed el. transposed element non-empty partners spanTo common parent
2 I H.56 #Einweisungsstelle anchor 0
2 II H.22 #start2 anchor 1
2 II H.22 #start1 anchor 1
2 V H.37c #l12005-12012 anchor 1
2 V H.37c #l12013-12019 anchor 1
2 III H.2:1 #gräslich seg 0
2 III H.2:1 #ging-die-Sonne anchor 0
2 III H.2:1 #die-er anchor 0
2 III H.2a:5 #Versumbruch anchor 0
2 III H.7:1 #Versumbruch anchor 0
2 II H.74 #l7172-l7174 anchor 1
2 II H.74 #l7175-l7177 anchor 1
2 V H.1 #after_11283 anchor 1
2 V H.1 #before_11286_b-11287 addSpan 1 anchor sp
2 II H.5a #p132_Indessen-So milestone 1 anchor div
2 II H.5a #p132_Sie-So milestone 1 anchor div
2 I H.52 #Zielposition anchor 0
2 H #before_7495_c anchor 0
H P124 #start_transposition_1 anchor 1
H P124 #start_transposition_2 anchor 1
for $ptr in $faust//transpose/ptr
let $target := id(substring-after($ptr/@target, '#'), $ptr)
for $milestone in $target[not(child::node())]
let $span-end := id(substring-after($milestone/@spanTo, '#'), $milestone),
    $parent := $span-end/..,
    $is-common := if ($span-end) then if ($parent is $span-end/..) then name($parent) else "✘" else "",
    $sigil := data(root($milestone)//idno[@type='faustedition']),
    $partners := for $partner in ($ptr/../ptr except $ptr) return id(substring-after($partner/@target, '#'), $ptr)
return <h:tr>
    <h:td>{$sigil}</h:td>
    <h:td>#{data($milestone/@xml:id)}</h:td>
    <h:td>{name($milestone)}</h:td>
    <h:td>{count($partners[not(child::node())])}</h:td>
    <h:td>{name($span-end)}</h:td>
    <h:td>{$is-common}</h:td>
    </h:tr> 
thvitt commented 5 years ago

The transposition doesn’t work because this use case has never been specified and thus never been implemented. The phrase-level transposition in the test manuscript has its xml:ids on lines.

I would very strongly suggest to check whether this couldn’t be handled in some different way (e.g., pointer to l or div or lg or ab). I haven’t looked at the actual cases yet, but transpositions across hierarchy borders might contain all kinds of ambiguities and will not be easy to implement.

gerritbruening commented 5 years ago

Same applies to addSpan (https://github.com/faustedition/faust-xml/issues/134).

thvitt commented 5 years ago

This table lists all empty elements that are referred by a transposition pointer. This points to different cases, at least the following can be distinguished:

  1. anchor with ≥ 1 non-empty partner(s): The non-empty segment is moved to the anchor position. Should work ok, although there might be encoding glitches that lead to unexpected whitespace behaviour. Cf. Was Raub, compare the inline apparatus.
  2. anchor with 0 non-empty partner(s): semantics unknown, @gerritbruening you’ll need to check what happens there
  3. milestone/spanTo with common parent: Can be unproblematically encoded using an enclosing element (seg / ab) instead of the milestone approach, which will make the existing implementation work. If this isn’t acceptable implement a preprocessing step
gerritbruening commented 5 years ago

Thanks for the query and its analysis! I will check nr. 2 for 1.2. As for nr. 3, I think we already looked out for a suitable enclosing element in @wissenbach|s time, but we didn't find one: seg is not allowed where we would need it, as it's phrase-level. ab is, and l has some time been allowed to appear in ab. It would be slightly abusive, though, since ab is not supposed to be a mere container element (i.e., is not suppused to be what we need).