Commit be762692 authored by MRodz's avatar MRodz Committed by mrodzis
Browse files

Add 3.8.1 and 3.8.2.1 line counting and paragraphs

parent c7183e3e
......@@ -12,5 +12,7 @@ import module namespace fontane-simple="http://fontane-nb.dariah.eu/teisimple"
at "tei2teisimple.xqm";
import module namespace tidySimple ="http://fontane-nb.dariah.eu/tidysimple" at "tidysimple.xqm";
let $tei := fontane-simple:main("16b00.xml")
return tidySimple:main($tei)
(:let $tei := fontane-simple:main("16b00.xml"):)
(:return tidySimple:main($tei):)
fontane-simple:main("16b00.xml")
\ No newline at end of file
......@@ -28,10 +28,7 @@ import module namespace simpleHelpers="http://fontane-nb.dariah.eu/teisimplehelp
declare function fontaneSimple:main($file as xs:string) as node()? {
let $doc :=
try {
(: TODO:An error with the index occured while building so we
temporarily put the file somewhere else :)
(: (doc("/db/sade-projects/textgrid/data/xml/data/" || $file)):)
(doc("/db/apps/SADE/resources/xml/" || $file))
(doc("/db/sade-projects/textgrid/data/xml/data/" || $file))
} catch * {
(console:log("It was not possible to open the requested file " || $file))
}
......@@ -175,11 +172,11 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
fontaneSimple:make-seg-with-rendition($node)
else if($node/following::*[1][self::tei:lb[@break = "no"]]) then
(simpleHelpers:start-line(),
(simpleHelpers:start-line($node),
simpleHelpers:trim-last-char($node))
else if ($node/preceding::*[1][self::tei:lb[@break = "no"]]) then
(simpleHelpers:start-line(),
(simpleHelpers:start-line($node),
simpleHelpers:trim-first-char($node))
else if($node/@type = "verse") then
......@@ -199,7 +196,7 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
requirements on the one hand while avoiding to run into hierarchical
problems in the further processing on the other hand:)
else if(not($node/@type = "item")) then
(simpleHelpers:start-line(),
(simpleHelpers:start-line($node),
fontaneSimple:transform($node/node()))
else if($node/@type = "item" and not($node/@xml:id)) then
......@@ -212,7 +209,7 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
()
else
(simpleHelpers:start-line(),
(simpleHelpers:start-line($node),
fontaneSimple:transform($node/node()))
case element(tei:handShift) return
......@@ -554,7 +551,7 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
}
case element(tei:ptr) return
text{"test"}
()
default return
fontaneSimple:transform($node/node())
......
......@@ -28,10 +28,7 @@ import module namespace functx = "http://www.functx.com";
declare function simpleHelpers:is-hand-contemporary($hand as xs:string?)
as xs:boolean {
let $hand := replace($hand, "#", "")
(: TODO:An error with the index occured while building so we
temporarily put the file somewhere else :)
(: let $file := doc("/db/sade-projects/textgrid/data/xml/data/16b00.xml"):)
let $file := doc("/db/apps/SADE/resources/xml/16b00.xml")
let $file := doc("/db/sade-projects/textgrid/data/xml/data/16b00.xml")
let $handNote := $file//tei:handNote[@xml:id = $hand]
return
if($handNote/@script = "contemporary")
......@@ -404,8 +401,13 @@ as text() {
return text{$trim-first-char}
};
declare function simpleHelpers:start-line() {
declare function simpleHelpers:start-line($node as element(tei:line))
as element(tei:milestone) {
element tei:milestone {
attribute unit {"line"}
attribute unit {"line"},
if($node/@rend) then
$node/@rend
else
()
}
};
\ No newline at end of file
......@@ -145,6 +145,19 @@ declare
fontaneSimple:transform($node)
};
(: 3.8.2 Paragraphs :)
declare
%test:name("Paragraphs")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><line xmlns=""http://www.tei-c.org/ns/1.0"" style=""margin-left:1.0cm"">noch nicht recht aufgehn.</line><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/><line xmlns=""http://www.tei-c.org/ns/1.0"" style=""margin-left:2.8cm"" rend=""indent"">Unter den andern</line></zone>")
%test:assertEquals("<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line""/>", "noch nicht recht aufgehn.", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/>", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""line"" rend=""indent""/>", "Unter den andern")
%test:args("<zone xmlns=""http://www.tei-c.org/ns/1.0""><figure xmlns=""http://www.tei-c.org/ns/1.0""><figDesc xmlns=""http://www.tei-c.org/ns/1.0""><ref xmlns=""http://www.tei-c.org/ns/1.0"" target=""http://vocab.getty.edu/aat/300200009"">horizontale einfache Absatzlinie</ref></figDesc></figure><milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/></zone>")
%test:assertEquals("<ab xmlns=""http://www.tei-c.org/ns/1.0"" type=""short-paragraph-line""/>", "<milestone xmlns=""http://www.tei-c.org/ns/1.0"" unit=""paragraph""/>")
function teisimple-test:analyze-paragraphs($node as element(*)) {
fontaneSimple:transform($node)
};
(: BOOK COVERS :)
declare
......
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