Commit 1197fa06 authored by Mathias Goebel's avatar Mathias Goebel 🎠

Merge branch 'release/4.6.0'

parents 735fbeba a0cd399e
project.name=http://textgrid.de/ns/SADE-fontane-develop
project.version=4.4.0
project.version=4.6.0
project.title=[Fontane] SADE
project.abbrev=SADE-fontane-develop
project.processorversion=4.7.0
......
......@@ -82,7 +82,10 @@ else if (tokenize($exist:path, '/') = "get") then
serialize($doc/xhtml:body/xhtml:div/xhtml:div[not(@class="teixml")][not(@class="facs")])
=> replace("xhtml:", "")
case "facs.html" return
if ($alternative and $id="2128f") (: using one transformation for two renderings :)
if ($alternative and $id="2128f")
(: using one transformation for two renderings :)
(: TODO: use this for 18vm7 1r as well
TODO: we are replacing instead of traversing the images :)
then replace(serialize($doc//xhtml:div[@class="facs"]), "xhtml:", "")
=> replace("1671z", "16725")
else
......
......@@ -167,7 +167,11 @@ declare function etTransfo:create-print-tei() as xs:string {
let $complete-print-file :=
element {QName("http://www.tei-c.org/ns/1.0", "teiCorpus")} {
$xmls,
etTransfo:get-literature()
try {
etTransfo:get-literature()
} catch * {
error(QName("error", "ETTRANSFO06"), "An error occured while creating the bibliography.")
}
}
return
xmldb:store($config:data-root || "/print/xml/", "fontane-full.xml", $complete-print-file)
......@@ -263,21 +267,52 @@ declare function etTransfo:get-literature() as element(tei:div) {
: bibliographic reference
:)
declare function etTransfo:make-bib-entries($type as xs:string) as element(tei:div)* {
for $entry in doc("/db/sade-projects/textgrid/data/xml/data/25547.xml")//tei:listBibl[@type = $type]/tei:bibl
for $choice in $entry//tei:choice
let $abbr := $choice//tei:abbr
let $full-ref := $choice//tei:expan
return
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute type {"entry"},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"abbr"},
$abbr
},
for $entry in doc("/db/sade-projects/textgrid/data/xml/data/25547.xml")//tei:listBibl[@type = $type]//tei:bibl
let $abbr :=
if($entry/tei:abbr) then
$entry/tei:abbr
else
$entry/tei:choice/tei:abbr
let $full-ref := $entry/tei:choice/tei:expan
let $bib-no := count($entry/ancestor::tei:bibl)
return
element {QName("http://www.tei-c.org/ns/1.0", "div")} {
attribute type {"entry"},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"abbr"},
$abbr
},
if($full-ref) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"full"},
$full-ref
}
}
else if($entry/tei:ptr[@target]) then
let $target-id := replace($entry/tei:ptr/@target, "#", "")
let $referenced-entry := $entry/ancestor::tei:body//tei:bibl[@xml:id = $target-id]
let $same-as := $referenced-entry/tei:choice/tei:abbr/string()
let $same-as-loc := $referenced-entry/ancestor::tei:listBibl[1]/@type/string()
return
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"same-as"},
$same-as
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"same-as-loc"},
$same-as-loc
})
else
(),
if($bib-no gt 0) then
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"sub-entry"},
$bib-no
}
else
()
}
};
......@@ -58,8 +58,12 @@ declare function prepCom:recursion($nodes as node()*) as node()* {
typeswitch ($node)
case text() return
$node
case comment() return
()
if(matches($node/string(), "rotate")) then
$node
else
()
(: in case of figures the text in the tei:figDesc serves as editorial
commentary - there's no tei:note referring to it. thus we set a
......@@ -204,7 +208,10 @@ declare function prepCom:find-literature($nodes as node()*) as node()* {
case text() return
$node
case comment() return
()
if(matches($node/string(), "rotate")) then
$node
else
()
case element(tei:ptr) return
if($node[ancestor::tei:note[@type = "editorial"]]) then
......
......@@ -24,7 +24,10 @@ declare function presort:prepare($nodes as node()*) as node()* {
$node
case comment() return
()
if(matches($node/string(), "rotate")) then
$node
else
()
default return
if($node/preceding-sibling::*[self::tei:addSpan][1][@place = 'interlinear'][@prev or @next]
......
......@@ -44,35 +44,49 @@ declare function fsort:sort($nodes as node()*) {
case text() return
$node
case element(tei:hi) return
if($node/@next and not($node/ancestor::tei:rs)) then
let $corresp-node := fsort:find-corresp-node($node, "next")
return
(: it's not sufficient to copy only the corresp node since
this would mean we'd loose the information about the tei:rs :)
if($corresp-node[self::tei:hi and parent::tei:rs]) then
(fsort:keep-node($node),
element {QName("http://www.tei-c.org/ns/1.0", "rs")} {
$corresp-node/parent::*/@*,
$corresp-node
})
else
fsort:default-return($node)
case comment() return
if(matches($node, "transform")) then
$node
else
fsort:default-return($node)
case element(tei:rs) return
(: in this case the tei:rs is empty after fsort:apply-all-nexts. we
don't need these. :)
if($node[child::*[@prev]] and count($node/child::*) = 1) then
()
else
fsort:default-return($node)
case element(tei:zone) return
fsort:default-return($node)
(: case element(tei:hi) return:)
(: if($node/@next and not($node/ancestor::tei:rs)) then:)
(: let $corresp-node := fsort:find-corresp-node($node, "next"):)
(: return:)
(: (: it's not sufficient to copy only the corresp node since:)
(: this would mean we'd loose the information about the tei:rs :):)
(: if($corresp-node[self::tei:hi and parent::tei:rs]) then:)
(: (fsort:keep-node($node),:)
(: element {QName("http://www.tei-c.org/ns/1.0", "rs")} {:)
(: $corresp-node/parent::*/@*,:)
(: $corresp-node:)
(: }):)
(: else:)
(: fsort:default-return($node):)
(: else:)
(: fsort:default-return($node):)
(::)
(::)
(: case element(tei:rs) return:)
(: (: in this case the tei:rs is empty after fsort:apply-all-nexts. we:)
(: don't need these. :):)
(: if($node[child::*[@prev]] and count($node/child::*) = 1) then:)
(: ():)
(: else:)
(: fsort:default-return($node):)
(: :)
(: case element(tei:date) return:)
(: fsort:keep-node($node):)
(::)
(: case element(tei:ref) return:)
(: fsort:keep-node($node):)
default return
fsort:default-return($node)
fsort:keep-node($node)
};
(:~
......
......@@ -146,7 +146,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
else if($node/@cause = "unclear") then
()
else if($node[matches(@copyOf, $node/preceding::tei:seg/@xml:id)]) then
else if($node[replace($node/@copyOf, "#", "") = $node/ancestor::tei:TEI//tei:seg/@xml:id]) then
fontaneSimple:mark-intervention($node, $uri)
else if($node/@cause ="catchword") then
......@@ -683,12 +683,28 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
replace($img-url, ",1000", ",500")
else
$img-url
let $rotation :=
(: no children and comment right after element:)
if($node/following-sibling::node()[1][self::comment()][matches(./string(), "rotate")]
and not($node/child::*)) then
substring-after($node/following::comment()[1], "rotate(")
=> substring-before("deg")
(: comment as first descendant :)
else if($node/child::node()[1][self::comment()][matches(./string(), "rotate")]) then
substring-after($node/child::comment()[1], "rotate(")
=> substring-before("deg")
else
()
return
element {QName("http://www.tei-c.org/ns/1.0", $node/name())}{
$node/@*,
attribute position {$display},
attribute href {$img-url},
if($rotation) then
attribute rotate {$rotation}
else
(),
fontaneSimple:transform($node/node(), $uri)
}
else
......@@ -807,6 +823,9 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
case element (tei:bibl) return
fontaneSimple:copy-element($node, $uri)
case element(tei:unclear) return
fontaneSimple:copy-element($node, $uri)
default return
fontaneSimple:transform($node/node(), $uri)
};
......@@ -942,7 +961,8 @@ as element(tei:milestone) {
let $whitespace-after :=
if($node/following::node()[1][normalize-space(.) = ""]
and not($node/following::*[1][@type = "heading"])) then
and not($node/following::*[1][@type = "heading"])
and not($node/following::text()[1][matches(substring(., 1, 1), "[\.,]")])) then
true()
else
false()
......@@ -1146,13 +1166,14 @@ declare function fontaneSimple:make-key($regular-name as xs:string?) {
let $affix := substring-after($regular-name, ".")
let $key :=
replace($name, "Ä", "A")
=> replace("ä", "a")
=> replace("Ö", "O")
=> replace("ö", "o")
=> replace("Ü", "U")
=> replace("ü", "u")
=> replace("ä", "ae")
=> replace("Ö", "Oe")
=> replace("ö", "oe")
=> replace("Ü", "Ue")
=> replace("ü", "ue")
=> replace(" ", "")
=> replace("\.", "")
=> replace(",", "")
return
(: sorts terms with a trailer, e.g. 'Friederich II. von Sachsen' after the ones
without, e.g. 'Friederich II.' :)
......
......@@ -582,7 +582,7 @@ if(request:get-parameter-names() = 'page')
let $page := if($page = '') then 'outer_front_cover' else $page
let $indexFile := doc('/db/sade-projects/textgrid/data/xml/xhtml/' || $uri || "/toc.xml" )
let $pageList2 := $indexFile//@data-page/string()
let $index2 := index-of($pageList2, $page)
let $index2 := (index-of($pageList2, $page))[1]
let $return :=
(
(
......
......@@ -56,6 +56,6 @@ declare function f-render:edited-text($node as node(), $model as map(), $id as x
let $file := substring-after($id, "data/") => substring-before(".xml")
return
<xhtml:div>
{doc("/db/apps/SADE/resources/xhtml/" || $file || ".html")}
{doc("/db/sade-projects/textgrid/data/xml/print/xhtml/" || $file || ".html")}
</xhtml:div>
};
This diff is collapsed.
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