Commit 37cd6654 authored by mrodzis's avatar mrodzis 🌎
Browse files

Minor improvements

parent cdb11219
...@@ -41,17 +41,20 @@ declare function fontaneSimple:main($doc as node()*, $uri as xs:string) as node( ...@@ -41,17 +41,20 @@ declare function fontaneSimple:main($doc as node()*, $uri as xs:string) as node(
let $front-covers := $doc//tei:sourceDoc/tei:surface[contains(@n, "front_cover")] let $front-covers := $doc//tei:sourceDoc/tei:surface[contains(@n, "front_cover")]
let $back-covers := $doc//tei:sourceDoc/tei:surface[contains(@n, "back_cover")] let $back-covers := $doc//tei:sourceDoc/tei:surface[contains(@n, "back_cover")]
let $content := $doc//tei:sourceDoc/tei:surface[not(contains(@n, "cover") let $content := ($doc//tei:sourceDoc/tei:surface[not(contains(@n, "cover")
or matches(@n, "spine"))] or matches(@n, "spine"))], $doc//tei:sourceDoc/tei:note[@type = "editorial"])
let $tei := <TEI xmlns="http://www.tei-c.org/ns/1.0"> let $tei :=
{$doc//tei:teiHeader} <teiCorpus xmlns="http://www.tei-c.org/ns/1.0">
<text> <TEI id="{$doc//tei:teiHeader//tei:titleStmt/tei:title/string()}">
<front>{fontaneSimple:transform($front-covers, $uri)}</front> {$doc//tei:teiHeader}
<body>{fontaneSimple:transform($content, $uri)}</body> <text>
<back>{fontaneSimple:transform($back-covers, $uri)}</back> <front>{fontaneSimple:transform($front-covers, $uri)}</front>
</text> <body>{fontaneSimple:transform($content, $uri)}</body>
</TEI> <back>{fontaneSimple:transform($back-covers, $uri)}</back>
</text>
</TEI>
</teiCorpus>
let $store := xmldb:store("/db/apps/SADE/resources/xml/", "fontane-tei-tmp.xml", $tei) let $store := xmldb:store("/db/apps/SADE/resources/xml/", "fontane-tei-tmp.xml", $tei)
return $tei return $tei
}; };
...@@ -80,7 +83,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a ...@@ -80,7 +83,7 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
or $node/ancestor::tei:desc[@type = "edited_text"] or $node/ancestor::tei:desc[@type = "edited_text"]
or $node/ancestor::tei:note[@type = "editorial"]) then or $node/ancestor::tei:note[@type = "editorial"]) then
if($node/parent::tei:rs and starts-with($node, " ") if($node/parent::tei:rs and starts-with($node, " ")
and not($node/preceding-sibling::*[1][self::tei:handShift]) and not($node/preceding-sibling::*[1][self::tei:handShift or self::tei:hi])
and simpleHelpers:is-trimming-necessary($node)) then and simpleHelpers:is-trimming-necessary($node)) then
simpleHelpers:prepare-text(text{substring-after($node, " ")}) simpleHelpers:prepare-text(text{substring-after($node, " ")})
else else
...@@ -145,6 +148,11 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a ...@@ -145,6 +148,11 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
else if($node/@rend ="|") then else if($node/@rend ="|") then
fontaneSimple:transform($node/node(), $uri) fontaneSimple:transform($node/node(), $uri)
else if($node/@place = "above"
and $node/preceding::node()[1][normalize-space(.) = ""]) then
(text{" "},
fontaneSimple:transform($node/node(), $uri))
else if(not($node/@xml:id)) then else if(not($node/@xml:id)) then
fontaneSimple:transform($node/node(), $uri) fontaneSimple:transform($node/node(), $uri)
...@@ -155,7 +163,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a ...@@ -155,7 +163,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:transform($node/node(), $uri)) fontaneSimple:transform($node/node(), $uri))
else else
fontaneSimple:transform($node/node(), $uri)) (fontaneSimple:transform($node/node(), $uri)),
text{" "})
case element(tei:addSpan) return case element(tei:addSpan) return
if($node/@type = "edited_text") then if($node/@type = "edited_text") then
...@@ -640,7 +649,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a ...@@ -640,7 +649,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
and not($node/@subtype = "footnote")) then and not($node/@subtype = "footnote")) then
() ()
else else
fontaneSimple:copy-element($node, $uri) (fontaneSimple:copy-element($node, $uri),
console:log($node))
case element(tei:certainty) return case element(tei:certainty) return
element {QName("http://www.tei-c.org/ns/1.0", "note")} { element {QName("http://www.tei-c.org/ns/1.0", "note")} {
...@@ -687,7 +697,9 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a ...@@ -687,7 +697,9 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:make-index-infos($node, $index-type), fontaneSimple:make-index-infos($node, $index-type),
fontaneSimple:transform($node/node(), $uri) fontaneSimple:transform($node/node(), $uri)
}, },
if(not($node//tei:abbr/text()[ends-with(., ":")])) then if(not($node//tei:abbr/text()[ends-with(., ":")]
or $node//text()[last()][ends-with(., "-")]
or $node/following::node()[1][self::text()][starts-with(., "-") or starts-with(., ".")])) then
text{" "} text{" "}
else else
()) ())
......
...@@ -40,7 +40,7 @@ declare function tidySimple:main($tei as node()*) { ...@@ -40,7 +40,7 @@ declare function tidySimple:main($tei as node()*) {
(: let $text-with-sections := tidySimple:make-structure($clear-surplus-hands):) (: let $text-with-sections := tidySimple:make-structure($clear-surplus-hands):)
let $header := $tei/tei:teiHeader let $header := $tei/tei:teiHeader
return return
xmldb:store("/db/apps/SADE/resources/xml/", "fontane-tei.xml", <TEI xmlns="http://www.tei-c.org/ns/1.0">{$header}{$tidy}</TEI>) xmldb:store("/db/apps/SADE/resources/xml/", "fontane-tei.xml", <TEI xmlns="http://www.tei-c.org/ns/1.0" id="{$tei//tei:TEI/@id}">{$header}{$tidy}</TEI>)
}; };
declare function tidySimple:sort-out-invalid-hands($nodes as node()*) declare function tidySimple:sort-out-invalid-hands($nodes as node()*)
......
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