Filter the placeholders to show them with the glossary words#1696
Merged
Conversation
akirk
reviewed
Sep 25, 2023
Co-authored-by: Alex Kirk <akirk@users.noreply.github.com>
Member
Author
|
To test the overhead in load time that this new regex might add, I used a Bash script to test it: Before, I have:
This is the script (change your local URL to test it): This is the output after 100 executions:
I have obtained similar outputs with another executions, so no overload is apparent. |
akirk
approved these changes
Sep 27, 2023
akirk
left a comment
Member
There was a problem hiding this comment.
Thank you for doing the performance tests, looks good if it performs at the same speed!
This was referenced Sep 28, 2023
This was referenced Oct 26, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Imagine we have the
showword in the glossary. If we have a placeholder in an original string finishing with thesletter and, without space, we have thehowword:%show, the current algorithm detects the glossary word and not the placeholder, showing on mouse over a popover with the glossary information, instead of detects the%splaceholder and thehowword.%show->%+show%show->%s+howFixes #1400.
Solution
This solution updates the regex that split the original string into an array, to isolate the placeholders, avoiding mixing parts of them with other substrings.
The regex used is the same used to detect warnings with the placeholders.
Testing Instructions
This PR adds two tests in the
tests/phpunit/testcases/test_template_helper_functions.phpfile:test_map_glossary_entries_with_placeholders_glued_glossary_wordstest_map_glossary_entries_with_placeholders_glued_glossary_words_in_the_plural_origin