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(
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 $content := $doc//tei:sourceDoc/tei:surface[not(contains(@n, "cover")
or matches(@n, "spine"))]
let $tei := <TEI xmlns="http://www.tei-c.org/ns/1.0">
{$doc//tei:teiHeader}
<text>
<front>{fontaneSimple:transform($front-covers, $uri)}</front>
<body>{fontaneSimple:transform($content, $uri)}</body>
<back>{fontaneSimple:transform($back-covers, $uri)}</back>
</text>
</TEI>
let $content := ($doc//tei:sourceDoc/tei:surface[not(contains(@n, "cover")
or matches(@n, "spine"))], $doc//tei:sourceDoc/tei:note[@type = "editorial"])
let $tei :=
<teiCorpus xmlns="http://www.tei-c.org/ns/1.0">
<TEI id="{$doc//tei:teiHeader//tei:titleStmt/tei:title/string()}">
{$doc//tei:teiHeader}
<text>
<front>{fontaneSimple:transform($front-covers, $uri)}</front>
<body>{fontaneSimple:transform($content, $uri)}</body>
<back>{fontaneSimple:transform($back-covers, $uri)}</back>
</text>
</TEI>
</teiCorpus>
let $store := xmldb:store("/db/apps/SADE/resources/xml/", "fontane-tei-tmp.xml", $tei)
return $tei
};
......@@ -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:note[@type = "editorial"]) then
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
simpleHelpers:prepare-text(text{substring-after($node, " ")})
else
......@@ -145,6 +148,11 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
else if($node/@rend ="|") then
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
fontaneSimple:transform($node/node(), $uri)
......@@ -155,7 +163,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
fontaneSimple:transform($node/node(), $uri))
else
fontaneSimple:transform($node/node(), $uri))
(fontaneSimple:transform($node/node(), $uri)),
text{" "})
case element(tei:addSpan) return
if($node/@type = "edited_text") then
......@@ -640,7 +649,8 @@ declare function fontaneSimple:transform($nodes as node()*, $uri as xs:string) a
and not($node/@subtype = "footnote")) then
()
else
fontaneSimple:copy-element($node, $uri)
(fontaneSimple:copy-element($node, $uri),
console:log($node))
case element(tei:certainty) return
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
fontaneSimple:make-index-infos($node, $index-type),
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{" "}
else
())
......
......@@ -40,7 +40,7 @@ declare function tidySimple:main($tei as node()*) {
(: let $text-with-sections := tidySimple:make-structure($clear-surplus-hands):)
let $header := $tei/tei:teiHeader
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()*)
......
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