From 5f425c1784f2f553eacf70af4e4c119796ba2119 Mon Sep 17 00:00:00 2001
From: Uwe Sikora <sikora@sub.uni-goettingen.de>
Date: Wed, 7 Feb 2018 17:57:40 +0100
Subject: [PATCH] tei:pb[@break='no'] just in cases it is deviding an
 orthographic unit. new flag @break='yes' in case it should break

---
 modules/intermediate_format/preprocessing.xqm | 25 +++++++++++--------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/modules/intermediate_format/preprocessing.xqm b/modules/intermediate_format/preprocessing.xqm
index a3f6f90..b81b7f5 100644
--- a/modules/intermediate_format/preprocessing.xqm
+++ b/modules/intermediate_format/preprocessing.xqm
@@ -188,20 +188,23 @@ declare function pre:preprocessing
             case element(pb) return (
                 let $preceeding-sibling := $node/preceding-sibling::node()[1]
                 let $following-sibling := $node/following-sibling::node()[1]
+                let $first := $node = $node/parent::node()/node()[not(self::text() and normalize-space(self::node()) = '')][1]
+                let $ignore := ("docAuthor", "app", "index", "seg", "bibl")
                 return
                     element {$node/name()}{
                         $node/@*,
-                        if ( ends-with($preceeding-sibling, " ") eq false() and starts-with($following-sibling, " ") eq false() ) then (
-                            attribute {"break"}{"no"}
-                        ) else ( )(:,
-                        attribute {"whitespace"}{
-                            if (ends-with($preceeding-sibling, " ")) then (
-                                "before"
-                            ) else (),
-                            if (starts-with($following-sibling, " ")) then (
-                                "after"
-                            ) else ()
-                        }:)
+                         
+                        if ( 
+                                ( $preceeding-sibling[self::text() and not(normalize-space(.) = '')] and ends-with($preceeding-sibling, " ") = false() )
+                                and
+                                ( $following-sibling[self::text() and not(normalize-space(.) = '')] and starts-with($following-sibling, " ") = false() )
+                            ) then ( attribute {"break"}{"no"} ) 
+                        
+                        else if ( $following-sibling[self::docAuthor or self::app or self::index or self::seg or self::bibl] ) then (
+                            attribute {"break"}{"yes"}
+                        )
+                        
+                        else ( )
                     }
             )
             
-- 
GitLab