Commit 9790efb0 authored by mrodzis's avatar mrodzis 🌎
Browse files

Fix bug in whitespace setting (cf. print#17 O fen)

parent 42d294d2
......@@ -133,7 +133,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:transform($node/node(), $uri)
case element(tei:add) return
(if($node/@type = "edited_text"
if($node/@type = "edited_text"
or $node/child::tei:seg[@type = "multiphrase"]) then
fontaneSimple:copy-element($node, $uri)
......@@ -154,6 +154,10 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
(text{" "},
fontaneSimple:transform($node/node(), $uri))
else if($node[@place = "superimposed"]) then
fontaneSimple:preserve-whitespace($node, $uri)
else if(not($node/@xml:id)) then
fontaneSimple:transform($node/node(), $uri)
......@@ -164,8 +168,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:transform($node/node(), $uri))
else
(fontaneSimple:transform($node/node(), $uri)),
text{" "})
fontaneSimple:transform($node/node(), $uri)
case element(tei:addSpan) return
if($node/@type = "edited_text") then
......@@ -354,13 +357,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
and simpleHelpers:is-hand-contemporary($node/@hand)) then
$node
else if($node/following::node()[1][self::text()]) then
let $first-char := $node/following::node()[1][self::text()]
=> substring(1, 1)
return
if(matches($first-char, "[\s]")) then
(fontaneSimple:transform($node/node(), $uri), text{" "})
else
fontaneSimple:transform($node/node(), $uri)
fontaneSimple:preserve-whitespace($node, $uri)
else
fontaneSimple:transform($node/node(), $uri)
......@@ -672,8 +669,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:copy-element($node, $uri)
case element(tei:ref) return
(fontaneSimple:copy-element($node, $uri),
util:log-system-out($node))
fontaneSimple:copy-element($node, $uri)
case element(tei:space) return
fontaneSimple:copy-element($node, $uri)
......@@ -1060,3 +1056,15 @@ as element(tei:term)* {
else
()
};
declare function fontaneSimple:preserve-whitespace($node as element(*), $uri as xs:string) as node()* {
let $first-char := $node/following::node()[1][self::text()]
=> substring(1, 1)
return
(fontaneSimple:transform($node/node(), $uri),
if(matches($first-char, "[\s]") and matches($node/following::node()[1][self::text()], "[\w]")) then
text{" "}
else
())
};
\ No newline at end of file
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