Fix XML brush: use the last occurrence of the tag #225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #143
The solution was suggested in the issue.
Changes proposed in this Pull Request
lastIndexOf
instead ofindexOf
: for some tags, it becomes vital to get the last occurrence. As we have encoded HTML entities (for example,<
as<
), some tags become a representation where the tag name appears a few times. For example<l>
looks like<l>
. And the first position of the tag name (l
) is1
which refers to the HTML entity, but we need to get the last appearance:4
.Testing instructions
Screenshot / Video
Before:
![CleanShot 2021-11-23 at 01 14 54@2x](https://user-images.githubusercontent.com/329356/142943105-74e488b6-1bb3-4787-a4d6-8cf904bcc32d.png)
After:
![CleanShot 2021-11-23 at 01 14 18@2x](https://user-images.githubusercontent.com/329356/142943115-f67e9149-1ac0-482a-8a5c-69ad40b3adb7.png)