Commit aa9716da authored by Michelle Rodzis's avatar Michelle Rodzis
Browse files

Improve whitespace handling

parent 095a5aeb
......@@ -509,7 +509,8 @@ declare function fontane-simple:strip-element($node as node()) {
: @return text() the formatted text
: :)
declare function local:prepare-text($node as text()) as text()? {
if(local:is-valid-text($node)) then
if(local:is-valid-text($node)
and not(normalize-space($node) = "")) then
let $cleared-hyphen :=
if(ends-with($node, "-") and not(local:keep-hyphen($node))) then
text {functx:substring-before-last($node, "-")}
......@@ -556,14 +557,14 @@ declare function local:copy-element($node as node()) as node() {
declare function local:has-valid-text($node as node()) as xs:boolean {
let $text-nodes := $node/descendant::text()
let $text-nodes := $node/descendant::text()[not(normalize-space(.) = "")]
let $results :=
for $text-node in $text-nodes
return
local:is-valid-text($text-node)
return
if(functx:is-value-in-sequence(true(), $results)) then
(true(), console:log("true"))
true()
else
false()
};
......@@ -573,7 +574,8 @@ declare function local:is-valid-text($node as text()) as xs:boolean {
let $current-hand := $node/preceding::tei:handShift[@new][1]/@new
return
if(fontane-simple:is-hand-contemporary($current-hand)
or $node/ancestor::*[@type = "edited_text"]) then
or $node/ancestor::*[@type = "edited_text"]
and not(normalize-space($node) = "")) then
true()
else
false()
......
This diff is collapsed.
Supports Markdown
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