Commit 63862b5f authored by mrodzis's avatar mrodzis 🌎
Browse files

Add test for 3.7.13 sketches as entities

parent a0ecad6d
......@@ -598,8 +598,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
else if($node/ancestor::tei:zone[@type = "illustration"]) then
(element {QName("http://www.tei-c.org/ns/1.0", $node/name())}{
$node/@*,
(: TODO: generalize :)
attribute href {tbleapi:get-url("16b00", $node/@xml:id, "png")},
attribute href {tbleapi:get-url($uri, $node/@xml:id, "png")},
attribute height-in-mm {fontaneSimple:get-height-in-mm($uri, $node/@xml:id)},
fontaneSimple:transform($node/node(), $uri)
}, util:log-system-out($node))
......@@ -953,17 +952,21 @@ $xml-id as xs:string) as xs:string {
and matches(@targets, "shape")]) then
$res
else
()
let $bla := util:log-system-out($full-uri)
let $bla := util:log-system-out($file)
let $shape := $file//tei:link[matches(@targets, $full-uri || "\.[0-9]+#" || $xml-id)
and matches(@targets, "shape")]/@targets
=> substring-before(" ")
=> replace("#", "")
let $shape-info := $file//svg:*[@id = $shape]
let $height-percent := xs:double($shape-info/@height => replace("%", ""))
let $width-percent := xs:double($shape-info/@width => replace("%", ""))
let $ratio := $height-percent div $width-percent
(: print area has a width of 113mm :)
return xs:string(113 * $ratio)
"Not found"
return
if($file = "Not found") then
""
else
let $bla := util:log-system-out($full-uri)
let $bla := util:log-system-out($file)
let $shape := $file//tei:link[matches(@targets, $full-uri || "\.[0-9]+#" || $xml-id)
and matches(@targets, "shape")]/@targets
=> substring-before(" ")
=> replace("#", "")
let $shape-info := $file//svg:*[@id = $shape]
let $height-percent := xs:double($shape-info/@height => replace("%", ""))
let $width-percent := xs:double($shape-info/@width => replace("%", ""))
let $ratio := $height-percent div $width-percent
(: print area has a width of 113mm :)
return xs:string(113 * $ratio)
};
\ No newline at end of file
......@@ -1435,4 +1435,14 @@ declare
function teisimple-test:connection-line($node as element(*)) {
fontaneSimple:transform($node, "16b00")
};
\ No newline at end of file
};
(: 3.7.13 sketches as entities -- changed 2018-11-20 :)
declare
%test:name("3.7.13 sketches as entities")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0"" type=""illustration"" ulx=""9.6"" uly=""11.8"" lrx=""10.2"" lry=""13.2""><seg xmlns=""http://www.tei-c.org/ns/1.0""><rs xmlns=""http://www.tei-c.org/ns/1.0"" type=""direct"" ref=""plc:Gentzrode_Speicher""><figure xmlns=""http://www.tei-c.org/ns/1.0"" xml:id=""a1""><figDesc xmlns=""http://www.tei-c.org/ns/1.0""><ref xmlns=""http://www.tei-c.org/ns/1.0"" target=""http://vocab.getty.edu/aat/300034065"">Gebäudeaufriss</ref>; Gentzrode, Speicher mit Wohnturm (Seitenfront)</figDesc></figure></rs></seg></zone>")
%test:assertEquals("<ab xmlns=""http://www.tei-c.org/ns/1.0"" type=""sketch""><rs type=""direct"" ref=""plc:Gentzrode_Speicher""><index indexName=""plc""><term type=""main"">Gentzrode Speicher</term><term type=""subref-of"">Gentzrode, Gentzrode. Speicher und Wohnturm</term></index><figure xml:id=""a1"" href=""https://textgridlab.org/1.0/digilib/rest/IIIF/textgrid:164hd/pct:7.468949311849614,12.023834858480528,40.56730446458543,38.518833794424346/,1000/0/default.png"" height-in-mm=""""><figDesc><ref target=""http://vocab.getty.edu/aat/300034065"">Gebäudeaufriss</ref>; Gentzrode, Speicher mit Wohnturm (Seitenfront)</figDesc></figure></rs></ab>")
function teisimple-test:sketches-as-entities($node as element(*)) {
fontaneSimple:transform($node, "16b00")
};
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