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