Commit 645d256b authored by MRodz's avatar MRodz Committed by mrodzis
Browse files

Debug testcases

parent f212085b
......@@ -75,11 +75,15 @@ as xs:boolean {
: :)
declare function simpleHelpers:prepare-text($node as text()) as text()? {
if(not(normalize-space($node) = "")) then
(: the @ serves as a flag for the removal of hyphens. this is necessary
since we sometimes have cases where a hyphen is the only content of a
string. functx:substring-before-last would therefore produce an empty
string which leads to problems while preparing the text any further. :)
let $cleared-hyphen :=
if(ends-with($node, "-") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "-")}
text {functx:substring-before-last($node, "-") || "@"}
else if(ends-with($node, "⸗") and not(simpleHelpers:keep-hyphen($node))) then
text {functx:substring-before-last($node, "⸗")}
text {functx:substring-before-last($node, "⸗") || "@"}
else
$node
let $cleared-round-s := replace($cleared-hyphen, "ſ", "s")
......@@ -93,7 +97,16 @@ declare function simpleHelpers:prepare-text($node as text()) as text()? {
(: else:)
(: $cleared-round-s:)
(: return text {$add-whitespace}:)
return text {$cleared-Tironian}
return
(: in cases where a given $node only consists of a hyphen we don't
return a text node because it's unnecessary and leads to problems
while testing. :)
if(matches($cleared-Tironian, "@")
and string-length($cleared-Tironian) gt 1
or not(matches($cleared-Tironian, "@"))) then
text {replace($cleared-Tironian, "@", "")}
else
()
else
()
};
......
......@@ -43,9 +43,9 @@ declare
declare
%test:name("Intervening in texts")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""10v""><zone xmlns=""http://www.tei-c.org/ns/1.0""><line xmlns=""http://www.tei-c.org/ns/1.0""><seg xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C03_10v_1"">mar</seg>-</line></zone><zone><line><add copyOf=""#C03_10v_1"" cause=""catchword"">mar</add>mor</line></zone></surface></zone>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""10v""/>", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "mar", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<seg xmlns=""http://www.tei-c.org/ns/1.0"" type=""reduplication""><hi xmlns=""http://www.tei-c.org/ns/1.0"" >‹</hi>mar<hi xmlns=""http://www.tei-c.org/ns/1.0"" >›</hi></seg>", "mor")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""10v""><zone xmlns=""http://www.tei-c.org/ns/1.0""><line xmlns=""http://www.tei-c.org/ns/1.0""><seg xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C03_10v_1"">mar</seg></line>-</zone><zone xmlns=""http://www.tei-c.org/ns/1.0""><line xmlns=""http://www.tei-c.org/ns/1.0""><add xmlns=""http://www.tei-c.org/ns/1.0"" copyOf=""#C03_10v_1"" cause=""catchword"">mar</add>mor</line></zone></surface></zone>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""10v""/>", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "mar", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<seg xmlns=""http://www.tei-c.org/ns/1.0"" type=""reduplication""><hi xmlns=""http://www.tei-c.org/ns/1.0"" >‹</hi>mar<hi xmlns=""http://www.tei-c.org/ns/1.0"" >›</hi></seg>", "mor")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><line xmlns=""http://www.tei-c.org/ns/1.0"">ei<mod xmlns=""http://www.tei-c.org/ns/1.0"" type=""subst""><del xmlns=""http://www.tei-c.org/ns/1.0"" rend=""overwritten"">l</del><add xmlns=""http://www.tei-c.org/ns/1.0"" place=""superimposed"">n</add></mod>la<seg xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""C02_32r_1"">den</seg>-</line><line xmlns=""http://www.tei-c.org/ns/1.0""><add xmlns=""http://www.tei-c.org/ns/1.0"" copyOf=""#C02_32r_1"">den</add>den</line></zone>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "ei", "n", "la", "den", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<seg xmlns=""http://www.tei-c.org/ns/1.0"" type=""reduplication""><hi xmlns=""http://www.tei-c.org/ns/1.0"" >‹</hi>den<hi xmlns=""http://www.tei-c.org/ns/1.0"" >›</hi></seg>", "den")
......
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