Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
097f9e87
Commit
097f9e87
authored
Jul 16, 2018
by
Michelle Rodzis
Committed by
mrodzis
Feb 05, 2019
Browse files
Add first draft for 3.8 line numbering
parent
c8a19ee5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimpleprint/tei2teisimple.xqm
View file @
097f9e87
...
...
@@ -124,12 +124,19 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
if($node/@type = "edited_text"
or $node/child::tei:seg[@type = "multiphrase"]) then
fontaneSimple:copy-element($node)
(: :)
(: else if($node[matches(@copyOf, $node/preceding::tei:seg/@xml:id):)
(: and not(@cause = "unclear")]) then:)
(: fontaneSimple:mark-intervention($node):)
else if($node[matches(@copyOf, $node/preceding::tei:seg/@xml:id)
and not(@cause = "unclear")]) then
else if($node/@cause = "unclear") then
()
else if($node[matches(@copyOf, $node/preceding::tei:seg/@xml:id)]) then
fontaneSimple:mark-intervention($node)
else if($node/@cause ="catchword"
or $node/@cause ="unclear"
) then
else if($node/@cause ="catchword") then
()
else if($node/@rend ="|") then
...
...
@@ -168,10 +175,12 @@ 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:trim-last-char($node)
(simpleHelpers:start-line(),
simpleHelpers:trim-last-char($node))
else if ($node/preceding::*[1][self::tei:lb[@break = "no"]]) then
simpleHelpers:trim-first-char($node)
(simpleHelpers:start-line(),
simpleHelpers:trim-first-char($node))
else if($node/@type = "verse") then
(if(not($node/preceding-sibling::tei:line[@type = "verse"])) then
...
...
@@ -186,8 +195,12 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
else
())
(: with opting for a tei:milestone we try to meet the project's
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
fontaneSimple:transform($node/node())
(simpleHelpers:start-line(),
fontaneSimple:transform($node/node()))
else if($node/@type = "item" and not($node/@xml:id)) then
element tei:item {
...
...
@@ -199,7 +212,8 @@ declare function fontaneSimple:transform($nodes as node()*) as node()* {
()
else
fontaneSimple:transform($node/node())
(simpleHelpers:start-line(),
fontaneSimple:transform($node/node()))
case element(tei:handShift) return
fontaneSimple:enhance-handshift($node)
...
...
@@ -599,6 +613,10 @@ as element(tei:seg) {
element tei:seg {
attribute rendition {simpleHelpers:filter-rendition($node)},
$node/(@* except (@style, @rendition)),
(if($node[self::tei:line or self::tei:zone]) then
attribute unit {$node/name()}
else
()),
fontaneSimple:transform($node/node())
}
};
...
...
@@ -666,11 +684,14 @@ as element(tei:seg) {
attribute type {"surplus"}
else
attribute type {"reduplication"},
<tei:hi xmlns="http://www.tei-c.org/ns/1.0">‹</tei:hi>,
if($node[self::tei:lb]) then
simpleHelpers:find-chars($node)
else
fontaneSimple:transform($node/node()),
<tei:hi xmlns="http://www.tei-c.org/ns/1.0">›</tei:hi>
}
};
...
...
modules/fontane/teisimpleprint/teisimplehelpers.xqm
View file @
097f9e87
...
...
@@ -347,22 +347,28 @@ as element(tei:section) {
<div/>
};:)
declare function simpleHelpers:find-chars($node as element(tei:lb)) as
text
() {
declare function simpleHelpers:find-chars($node as element(tei:lb)) as
node
()
*
{
let $prev-line := $node/preceding::tei:line[1]
let $prev-last-text := $prev-line/text()[last()]
let $prev-length := string-length($prev-last-text)
let $prev-char := substring($prev-last-text, $prev-length,$prev-length)
let $next-line := $node/following::tei:line[1]
let $next-first-text := $next-line/text()[1]
let $next-char := substring($next-first-text, 1, 1)
let $next-char := substring($next-first-text, 1, 1)
let $milestone :=
element tei:milestone {
attribute unit {"line"}
}
return text{$prev-char || $next-char}
return
(text{$prev-char}, $milestone, text {$next-char})
};
declare function simpleHelpers:trim-last-char($node as element(tei:line))
as text() {
let $blae := console:log($node)
let $length := string-length($node/string())
let $trim-last-char := substring($node/string(), 1, $length - 1)
return text{$trim-last-char}
...
...
@@ -370,8 +376,13 @@ as text() {
declare function simpleHelpers:trim-first-char($node as element(tei:line))
as text() {
let $blae := console:log($node)
let $length := string-length($node/string())
let $trim-first-char := substring($node/string(), 2, $length)
return text{$trim-first-char}
};
declare function simpleHelpers:start-line() {
element tei:milestone {
attribute unit {"line"}
}
};
\ No newline at end of file
modules/fontane/teisimpleprint/tests/teisimple-test.xql
View file @
097f9e87
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment