Commit 9a2cbe9e authored by mrodzis's avatar mrodzis 🌎
Browse files

Implement first draft for integrations in edited text

parent 281c1504
......@@ -343,6 +343,9 @@ declare function simple2xhtml:recursion($nodes as node()*) as node()* {
]) then
()
else if($node/@type = "integration") then
simple2xhtml:make-integration($node)
else
element xhtml:span {
simple2xhtml:set-hs-info($node, "nb-seg"),
......@@ -565,3 +568,61 @@ as attribute() {
return
attribute class {$classes}
};
declare function simple2xhtml:make-integration($node as element(tei:seg)) {
let $bracket := $node//tei:ab[@function = "integrate"]
(: target is the side where the pointy end of the bracket goes.
corresp is the side where bracket faces to.
example: target { corresp :)
let $target-id := replace($bracket/@target, "#", "")
let $target := $node//*[@xml:id = $target-id]
let $corresp-id := replace($bracket/@corresp, "#", "")
let $corresp := $node//*[@xml:id = $corresp-id]
let $lines-target := count($target//tei:milestone[@unit = "line"])
let $lines-corresp := count($corresp//tei:milestone[@unit = "line"])
let $max-number-of-lines :=
if($lines-target gt $lines-corresp) then
$lines-target
else
$lines-corresp
let $bracket-size := 12 * ($max-number-of-lines + 1)
return
element xhtml:table {
attribute class {"integration"},
element xhtml:tr {
element xhtml:td {
attribute class {"integration-left"},
if($bracket/@rend = "bracket_right") then
simple2xhtml:recursion($corresp/node())
else if($bracket/@rend = "bracket_left") then
simple2xhtml:recursion($target/node())
else
()
},
element xhtml:td {
attribute class {"integration-bracket"},
attribute style {"font-size: " || $bracket-size || "pt;"},
if($bracket/@rend = "bracket_right") then
text{"}"}
else if($bracket/@rend = "bracket_left") then
text{"{"}
else
()
},
element xhtml:td {
attribute class {"integration-right"},
if($bracket/@rend = "bracket_right") then
simple2xhtml:recursion($target/node())
else if($bracket/@rend = "bracket_left") then
simple2xhtml:recursion($corresp/node())
else
()
}
}
}
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment