Skip to content

Commit

Permalink
less naive solution for #52
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Mar 20, 2023
1 parent cb6b053 commit 56d4a34
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/folia_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2993,11 +2993,16 @@ namespace folia {
string val = str(cls());
val = trim( val );
if ( val.empty() ) {
if ( index(0)->implicitspace() ){
// OK, an "empty" text is allowed for elements with the
// implicitspace property
// we have to check for a child with the IMPLICITSPACE property
// if so, an "empty" text is allowed.
bool has_implicit = false;
for ( const auto it : _data ){
if ( it->implicitspace() ){
has_implicit = true;
break; // we are done here
}
}
else {
if ( !has_implicit ){
throw ValueError( "attempt to add an empty <t> to word: "
+ parent->id() );
}
Expand Down

0 comments on commit 56d4a34

Please sign in to comment.