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
a63d491e
Commit
a63d491e
authored
Dec 21, 2018
by
mrodzis
🌿
Browse files
Improve whitespace handling when changing fonts (cf print#61)
parent
5656f77f
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/fontane/teisimpleprint/tei2teisimple.xqm
View file @
a63d491e
...
...
@@ -853,12 +853,27 @@ as element(tei:pb) {
declare function fontaneSimple:enhance-handshift($node as element(tei:handShift))
as element(tei:milestone) {
let $prev-hand := $node/preceding::tei:handShift[@new][1]
let $whitespace-before :=
if($node/preceding::node()[1][normalize-space(.) = ""]) then
true()
else
false()
let $whitespace-after :=
if($node/following::node()[1][normalize-space(.) = ""]) then
true()
else
false()
return
element {QName("http://www.tei-c.org/ns/1.0", "milestone")} {
attribute unit {"handshift"},
attribute subtype {if($node/@new) then $node/@new else $prev-hand/@new},
attribute rend {concat("script(", (if($node/@script) then $node/@script else ""), ") ",
"medium(", (if($node/@medium) then $node/@medium else ""), ")")},
(if($whitespace-before) then attribute ws-before {"true"} else ()),
(if($whitespace-after) then attribute ws-after {"true"} else ()),
$node/(@* except (@new, @medium, @script))
}
};
...
...
modules/fontane/teisimpleprint/teisimplehelpers.xqm
View file @
a63d491e
...
...
@@ -350,7 +350,9 @@ $node as element(tei:milestone)) as xs:boolean {
if($prev-hand
and $prev-hand = $prev-valid-hand
and $node/@subtype = $prev-hand/@subtype
and $node/@rend = $prev-hand/@rend) then
and $node/@rend = $prev-hand/@rend
and $node/@ws-before = $prev/@ws-before
and $node/@ws-after = $prev/@ws-after) then
true()
else
false()
...
...
modules/fontane/teisimpleprint/tidysimple.xqm
View file @
a63d491e
...
...
@@ -61,7 +61,7 @@ as node()* {
let $prev-handshift := $node/preceding::tei:milestone[@unit = "handshift"][1]
return
if($node/@unit = "handshift" and
simpleHelpers:is-hand-valid($tidySimple:valid-hands, $node)) then
simpleHelpers:is-hand-valid($tidySimple:valid-hands, $node)) then
tidySimple:clear-handshift($node)
else if($node/@unit = "handshift") then
...
...
@@ -200,6 +200,8 @@ declare function tidySimple:clear-handshift($node as element(tei:milestone))
as element(tei:milestone) {
element {QName("http://www.tei-c.org/ns/1.0", $node/name())} {
attribute unit {"handshift"},
$node/@ws-before,
$node/@ws-after,
if($node/@subtype = "") then
()
else
...
...
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