Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
677984b3
Commit
677984b3
authored
Jun 22, 2018
by
MRodz
Committed by
mrodzis
Feb 05, 2019
Browse files
Add 3.5 glued pages
parent
cbe1c266
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimple-test.xql
View file @
677984b3
...
...
@@ -28,6 +28,25 @@ declare
fontane-simple:transform($node)
};
(: 3.5 Glued Pages :)
declare
%test:name("Glued pages")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""Ir"" facs=""http://textgridrep.org/textgrid:18qcd"" type=""clipping"" subtype=""Kalenderblatt"" attachment=""partially_glued-posthumous"" ulx=""1.8"" uly=""2.3"" lrx=""8.8"" lry=""13.5""><graphic xmlns=""http://www.tei-c.org/ns/1.0"" n=""B03_002"" url=""http://textgridrep.org/textgrid:18qcd"" mimeType=""image/jpeg""/></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""Ir""/>")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var"" facs=""http://textgridrep.org/textgrid:167nm"" type=""clipping"" subtype=""Zeitungsausschnitt"" attachment=""formerly_partially_glued""><line xmlns=""http://www.tei-c.org/ns/1.0"">Test</line></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var""/>","<div xmlns=""http://www.tei-c.org/ns/1.0"" type=""clipping"" subtype=""Zeitungsausschnitt"" attachment=""formerly_partially_glued"">Test</div>")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var"" facs=""http://textgridrep.org/textgrid:167nm"" type=""pocket"" subtype=""angeklebte_cremefarbige_Tasche_von_Fontane_angefertigt_-_Angeklebtes_Blatt"" attachment=""formerly_partially_glued""><line xmlns=""http://www.tei-c.org/ns/1.0"">Test</line></surface>")
%test:assertEquals("<pb xmlns=""http://www.tei-c.org/ns/1.0"" n=""30var""/>")
%test:args("<surface xmlns=""http://www.tei-c.org/ns/1.0"" facs=""http://textgridrep.org/textgrid:169hc"" type=""label"" subtype=""Oblate"" ulx=""6.2"" uly=""3.7"" lrx=""7.6"" lry=""5.4""/>")
%test:assertEmpty
function teisimple-test:analyze-glued($node as element(*)) {
fontane-simple:transform($node)
};
(: 3.8.1: Line counting :)
declare
%test:name("Line counting")
...
...
modules/fontane/transform2teisimple.xqm
View file @
677984b3
...
...
@@ -208,64 +208,62 @@ declare function fontane-simple:transform($nodes as node()*) as node()* {
local:keep-element($node)
case element(tei:surface) return
if(matches($node/@n, "cover"))
then
(if(not($node/@n = "outer_front_cover"))
then
element tei:pb {
if($node/@n = "inner_front_cover"
or $node/@n = "outer_back_cover")
then
attribute type {"flyleaf"}
else
attribute type {"cover"}
}
else
(),
element tei:div {
attribute type {$node/@n},
if(matches($node/@n, "cover")) then
(if(not($node/@n = "outer_front_cover"))
then
element tei:pb {
if($node/@n = "inner_front_cover"
or $node/@n = "outer_back_cover")
then
attribute type {"flyleaf"}
else
attribute type {"cover"}
}
else
(),
element tei:div {
attribute type {$node/@n},
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
})
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "clipping") then
(local:make-pb($node),
(if(not($node/@subtype = "Kalenderblatt")) then
element tei:div{
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
})
else if(matches($node/@n, "[0-9]{1,4}[rv]{1}")
and not($node/@type = "fragment"))
then
(element tei:pb{
attribute n {$node/@n}
},
if(local:has-valid-text($node))
then
element tei:div{
attribute type {"page"},
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
}
else
())
else if(matches($node/@n, "[0-9]{1,4}[rv]{1}")
and $node/@type = "fragment")
then
(element tei:pb{
attribute n {$node/@n}
},
(: if all descendant text nodes shoudln't be serialized, z.g. parent::fw or parent::stamp :)
if($node)
then
element tei:div{
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
}
else
())
}
else
()))
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "fragment") then
(local:make-pb($node),
element tei:div{
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
})
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "pocket") then
local:make-pb($node)
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")
and $node/@type = "label" and $node/@subtype = "Oblate") then
()
else if(matches($node/@n, "[0-9IVXMCD]{1,7}[rv]{1}")) then
(local:make-pb($node),
element tei:div{
attribute type {"page"},
$node/((@* except @facs) except @n),
fontane-simple:transform($node/node())
})
else if($node/@type = "label" and
(contains($node/@subtype, "Fontane")
or contains($node/@subtype, "Hersteller"))
)
then
element tei:div {
attribute type {"label"},
fontane-simple:transform($node/node())
}
) then
element tei:div {
attribute type {"label"},
fontane-simple:transform($node/node())
}
else
()
...
...
@@ -468,4 +466,10 @@ declare function local:keep-element($node as node()) as node() {
declare function local:has-valid-text($node as node()) as xs:boolean {
(: TODO :)
true()
};
declare function local:make-pb($node as node()) as element(tei:pb) {
element {QName("http://www.tei-c.org/ns/1.0", "pb")}{
$node/@n
}
};
\ No newline at end of file
resources/xml/tei-simple.xml
View file @
677984b3
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment