Commit 2b384067 authored by mrodzis's avatar mrodzis 🌿
Browse files

Add handling for headings with new line (cf. print#22)

parent f6d28e9d
......@@ -725,7 +725,6 @@ declare function fontaneSimple:make-head($node as node()) as element(tei:head) {
else
attribute style {"default"}
),
attribute type {"former-" || $node/name()},
$node/@subtype,
(if($node/@rendition) then
$node/@rendition
......
......@@ -35,6 +35,7 @@ declare function tidySimple:main($tei as node()*) {
let $tidy := tidySimple:sort-out-invalid-hands($tei//tei:text)
=> tidySimple:sort-out-surplus-elements()
=> tidySimple:whitespaces()
=> tidySimple:split-headings()
(: => tidySimple:sort():)
(: let $text-with-sections := tidySimple:make-structure($clear-surplus-hands):)
let $header := $tei/tei:teiHeader
......@@ -338,6 +339,42 @@ declare function tidySimple:whitespaces($nodes as node()*) as node()* {
};
declare function tidySimple:sort($nodes as node()*) as node()* {
presort:main($nodes)
declare function tidySimple:split-headings($nodes as node()*) as node()* {
for $node in $nodes return
typeswitch($node)
case text() return
$node
case element(tei:head) return
if($node//tei:lb[@type = "edited_text"]) then
let $lb := $node//tei:lb[@type = "edited_text"]
let $split-top := $node/node()[. << $lb]
let $split-bottom := $node/node()[. >> $lb]
let $test := util:log-system-out($split-top)
return
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
(element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"upper-part"},
$split-top
},
element {QName("http://www.tei-c.org/ns/1.0", "lb")} {
attribute type {"edited_text"}
},
element {QName("http://www.tei-c.org/ns/1.0", "seg")} {
attribute type {"lower-part"},
$split-bottom
})
}
else
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
tidySimple:split-headings($node/node())
}
default return
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
$node/@*,
tidySimple:split-headings($node/node())
}
};
\ No newline at end of file
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