Skip to content

Commit

Permalink
Improve formatting of exported solutions in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
blmage committed Oct 26, 2024
1 parent 86f5208 commit 21b7842
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/solutions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,14 @@ export const getReaderFriendlySummaryTokens =
* @param {Solution} solution A solution.
* @returns {string[]} All the sentences that can be generated from the given solution.
*/
export const getUnfoldedSentences = lift(cartesianProduct(_.tokens).map(it.join('')));
export const getUnfoldedSentences = lift(
cartesianProduct(_.tokens)
.map(
it.join('')
.trim()
.replaceAll(/(\s)\1+/g, '$1')
)
);

/**
* @param {Solution} solution A solution.
Expand Down

0 comments on commit 21b7842

Please sign in to comment.