Navigation Menu

Skip to content

Commit

Permalink
update cleanupSpacing based on backport of main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaSedghi committed Apr 15, 2022
1 parent ccc38a3 commit 1b1ac45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Virastar.php
Expand Up @@ -978,9 +978,9 @@ protected function cleanupSpacing($text)
// except before/after preservers and before new-lines
// .replace(/(?<![_]{2})([ ]{2,})(?![_]{2}|\n)/g, ' ') // WORKS: using lookbehind
return preg_replace('/([^_])([ ]{2,})(?![_]{2}|\n)/u', '$1 ',
// cleans whitespace/zwnj between new-lines
// cleans tab/space/zwnj/zwj/nbsp between two new-lines(\n)
// @REF: https://stackoverflow.com/a/10965543/
preg_replace('/\n[\s\x{200c}]*\n/u', "\n\n", $text)
preg_replace('/^\n([\t\x{0020}\x{200c}\x{200d}\x{00a0}]*)\n$/um', "\n\n", $text)
);
}

Expand Down

0 comments on commit 1b1ac45

Please sign in to comment.