Commit fac03eec authored by Michelle Rodzis's avatar Michelle Rodzis Committed by mrodzis
Browse files

Tidy up tei:seg/@style

parent 7f6e2480
......@@ -279,7 +279,7 @@ declare
declare
%test:name("Auction numbers")
%test:args("<seg xmlns=""http://www.tei-c.org/ns/1.0"" type=""auction_number"">5<mod xmlns=""http://www.tei-c.org/ns/1.0"" type=""subst""><del xmlns=""http://www.tei-c.org/ns/1.0"" rend=""overwritten"">10</del><add place=""superimposed"">09</add></mod>-7</seg>")
%test:args("<seg xmlns=""http://www.tei-c.org/ns/1.0"" type=""auction_number"">5<mod xmlns=""http://www.tei-c.org/ns/1.0"" type=""subst""><del xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""overwritten"">10</del><add place=""superimposed"">09</add></mod>-7</seg>")
%test:assertEmpty
function teisimple-test:analyze-auction($node as element(*)) {
fontane-simple:transform($node)
......@@ -682,13 +682,13 @@ declare
declare
%test:name("Special cases (superscript and subscript)")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><seg xmlns=""http://www.tei-c.org/ns/1.0"" style=""vertical-align:super; text-decoration:underline""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg></zone>")
%test:assertEquals("<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""vertical-align:super; text-decoration:underline""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg>")
%test:assertEquals("<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""vertical-align:super;""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg>")
%test:args("<line xmlns=""http://www.tei-c.org/ns/1.0""><hi xmlns=""http://www.tei-c.org/ns/1.0""><seg xmlns=""http://www.tei-c.org/ns/1.0"" style=""text-decoration:underline""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Dinstag d. 20</seg>.</hi><seg xmlns=""http://www.tei-c.org/ns/1.0"" style=""text-decoration:underline; vertical-align:super"">ten</seg></line>")
%test:assertEquals("<hi xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Dinstag d. 20.</hi>","<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""text-decoration:underline; vertical-align:super"">ten</seg>")
%test:assertEquals("<hi xmlns=""http://www.tei-c.org/ns/1.0""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>Dinstag d. 20.</hi>","<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""vertical-align:super"">ten</seg>")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><seg xmlns=""http://www.tei-c.org/ns/1.0"" style=""vertical-align:sub; text-decoration:underline""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg></zone>")
%test:assertEquals("<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""vertical-align:sub; text-decoration:underline""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg>")
%test:assertEquals("<seg xmlns=""http://www.tei-c.org/ns/1.0"" rendition=""vertical-align:sub;""><handShift xmlns=""http://www.tei-c.org/ns/1.0"" new=""#Fontane""/>r</seg>")
function teisimple-test:analyze-superscript($node as element(*)) {
fontane-simple:transform($node)
......
......@@ -101,7 +101,7 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
case element(tei:retrace) return
if($node/@rend) then
element tei:seg {
$node/@rend,
attribute rendition {$node/@rend},
fontane-simple:transform($node/node())
}
else
......@@ -184,7 +184,7 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
fontane-simple:transform($node/node())
else if($node/@style) then
element{QName("http://www.tei-c.org/ns/1.0", $node/name())}{
attribute rendition {$node/@style},
attribute rendition {fontane-simple:filter-rendition($node/@style)},
$node/(@* except @style),
fontane-simple:transform($node/node())
}
......@@ -518,6 +518,7 @@ declare function local:prepare-text($node as text()) as text()? {
else
$node
let $cleared-round-s := replace($cleared-hyphen, "ſ", "s")
(: let $normalized := normalize-space($cleared-round-s):)
return text {$cleared-round-s}
else
()
......@@ -666,4 +667,20 @@ declare function local:get-font-size($node as node()) as xs:string {
(: example for style: "font-size:large; letter-spacing:0.2cm; text-decoration:underline" :)
let $tmp := substring-after($node/descendant-or-self::tei:seg[matches(@style, "font-size")]/@style, "font-size:")
return substring-before($tmp, ";")
};
declare function fontane-simple:filter-rendition($seg-styles as xs:string) as xs:string* {
let $styles := tokenize($seg-styles, " ")
let $relevant-styles :=
for $style in $styles
return
if(matches($style, "font")
or matches($style, "align")
or matches($style, "spacing")
or matches($style, "line-through")) then
$style
else
()
return string-join($relevant-styles, " ")
};
\ 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