Commit cdb11219 authored by mrodzis's avatar mrodzis 🌎
Browse files

Improve whitespace handling

parent c4e30ed3
......@@ -81,7 +81,10 @@ declare function simpleHelpers:prepare-text($node as text()) as text()? {
string. functx:substring-before-last would therefore produce an empty
string which leads to problems while preparing the text any further. :)
let $cleared-end-hyphen :=
if(ends-with($node, "-") and not(simpleHelpers:keep-hyphen($node))) then
if((ends-with($node, "-") or ends-with($node, "⸗"))
and $node/parent::tei:add) then
$node
else if(ends-with($node, "-") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "-") || "@P"}
else if(ends-with($node, "⸗") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "⸗") || "@P"}
......@@ -122,7 +125,7 @@ declare function simpleHelpers:prepare-text($node as text()) as text()? {
: @return xs:boolean
:)
declare function simpleHelpers:keep-hyphen($node as text()) as xs:boolean {
if($node/parent::tei:line/following-sibling::*[1][self::tei:lb[@break = "keepHyphen"]])
if($node/ancestor::tei:line/following-sibling::*[1][self::tei:lb[@break = "keepHyphen"]])
then
true()
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