Skip to content

Commit

Permalink
Strip paragraphs for loop checking
Browse files Browse the repository at this point in the history
Up until now, paragraphs were not stripped from
whitespace before checking whether they were loop
terminators.
  • Loading branch information
AntonOellerer committed Sep 26, 2022
1 parent ce5bfe2 commit 6d6f545
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'com.docutools'
version = '1.5.0'
version = '1.5.1'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private List<IBodyElement> getLoopBody(String placeholderName, List<IBodyElement
return remaining.stream()
//Could be written nice with `takeUntil(element -> (element instanceof XP xp && eLM.equals(WU.toString(xp)))
.takeWhile(element -> !(element instanceof XWPFParagraph xwpfParagraph
&& endLoopMarkers.stream().anyMatch(endLoopMarker -> endLoopMarker.equals(WordUtilities.toString(xwpfParagraph)))))
&& endLoopMarkers.stream().anyMatch(endLoopMarker -> endLoopMarker.equals(WordUtilities.toString(xwpfParagraph).strip()))))
.toList();
}

Expand Down

0 comments on commit 6d6f545

Please sign in to comment.