Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple space rendering #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adipose
Copy link

@adipose adipose commented Nov 7, 2019

The code tries to replace multiple spaces with "nbsp; " and "nbsp;" depending on whether it is odd or even. The original preg_replace is only capturing the trailing spaces, but replacing all of them, which means the first space always gets silently dropped.

The code tries to replace multiple spaces with "nbsp; " and "nbsp;" depending on whether it is odd or even.  The original preg_replace is only capturing the trailing spaces, but replacing all of them, which means the first space always gets silently dropped.
@jfcherng
Copy link

jfcherng commented Nov 7, 2019

I would suggest you use a maintained fork rather than fixing a single issue. There are still many problems in this repo...

Such as

They all require PHP >= 7.1 though.

@adipose
Copy link
Author

adipose commented Nov 7, 2019

Well, I did check your branch and you avoided that bug by using matches[0] and no capture group. :)

@jfcherng
Copy link

jfcherng commented Nov 8, 2019

Yes. No need to use capture group and the codes can be cleaner.

https://github.com/jfcherng/php-diff/blob/bc52a5a/src/Renderer/Html/AbstractHtml.php#L273-L284

@JBlond
Copy link

JBlond commented Mar 7, 2020

Yes, my repo is the fix version of the current repo. The functions are the same plus a few new ones.

PR's are welcomed in my repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants