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

Improve whitespace handling between tei:hi (cf. #37)

parent 15ff7420
......@@ -315,7 +315,16 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:transform($node/node(), $uri)
case element(tei:hi) return
fontaneSimple:copy-element($node, $uri)
(element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
fontaneSimple:transform($node/node(), $uri)
},
if(not($node/@prev or $node/@next)
and $node/following::node()[1][self::text()][normalize-space(.) = ""]
and $node/following::*[1][self::tei:hi]) then
text{"@"}
else
())
(: TODO if $node/@type = "highlighted" then make
a hi[@type = "vertical-mark"] in the second stage of creating the
......
......@@ -1465,4 +1465,17 @@ declare
function teisimple-test:additions-with-vague-placement($node as element(*)) {
fontaneSimple:transform($node, "16b00")
};
(: Two sequential tei:hi that are divided by a whitespace, e.g. C6, "Schlachtfeld von Jena und Auerstädt" :)
declare
%test:name("Two sequential tei:hi that are divided by a whitespace")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs><hi>J<seg style=""text-decoration:underline"">ena</seg></hi> <hi><seg style=""text-decoration:underline"">und</seg></hi> <hi><seg style=""text-decoration:underline"">Auerſtäd</seg>t</hi></rs></line>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0""><hi>Jena</hi>@<hi>und</hi>@<hi>Auerstädt</hi></rs>")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><rs><hi xml:id=""some-id"" next=""#another-id"">J<seg style=""text-decoration:underline"">ena</seg></hi> <hi xml:id=""another-id"" prev=""#some-id""><seg style=""text-decoration:underline"">und</seg></hi></rs></line>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "<rs xmlns=""http://www.tei-c.org/ns/1.0""><hi xml:id=""some-id"" next=""#another-id"">Jena</hi><hi xml:id=""another-id"" prev=""#some-id"">und</hi></rs>")
function teisimple-test:hi-with-whitespaces($node as element(*)) {
fontaneSimple:transform($node, "16b00")
};
\ 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