-
Notifications
You must be signed in to change notification settings - Fork 953
[IM] 19477 yoast markers break html of content in classic editor and shopify #19648
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
Closed
hdvos
wants to merge
30
commits into
feature/lingo-fixes
from
19477-attempt-3-yoast-markers-break-html-of-content-in-shopify-and-classic
Closed
Changes from 23 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
779d541
add check for advanced custom fields
hdvos ddb5a77
Merge branch 'trunk' into PC-965-yoast-markers-break-html-of-content
hdvos 874438c
Merge branch 'PC-965-yoast-markers-break-html-of-content' into 19477-…
hdvos f462016
reapply PC-965
hdvos 20f462e
re-apply PC 1029
hdvos 009ff23
semtence tokenizer fix
hdvos 21a3c9c
add jsdoc
hdvos 3e1b9ed
modify extra check for removing outer html tags
hdvos aa26fe7
update isValidPair check
hdvos 47ce9e8
add specs for isValidPair
hdvos ac3c71e
rename function
hdvos 9dbd692
adapt specs
hdvos 03fe68c
adapt specs
hdvos 88bcbc2
solve non breaking space problem in replaceQuotes
hdvos 56ca5aa
adapt replaceQuotesSpec
hdvos 890edce
rename replaceQuotes
hdvos 32843dc
adapt fulltesttexts
hdvos ca19e85
commit snapshots
hdvos bffd1e3
Merge branch 'feature/lingo-fixes' into 19477-attempt-3-yoast-markers…
hdvos 4806b48
fix linting error
hdvos abbd101
fix marking of gutenberg.
hdvos 69b7016
refine isValidTagPair
hdvos c443dae
update comment
hdvos 42ef420
rename replaceQuotesSpec to normalizeHTMLSpec
hdvos 2f90b0d
adapt fulltextTests
hdvos 40d46f2
Update packages/yoastseo/src/languageProcessing/helpers/sentence/Sent…
hdvos 9ab066d
Update packages/js/src/decorator/tinyMCE.js
hdvos 51e4745
apply CR comments
hdvos eeede89
add spec for normalizeHTML when an nbsp is present
hdvos 5c0c8ae
rename isMaybeSingleQuoted to doesNotContainDoubleQuotedMark
hdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Binary file added
BIN
+23.5 KB
...ge-snapshot-tests-2-components-sidebar-navigation-navigation-context-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
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
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
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
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
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
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
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
35 changes: 35 additions & 0 deletions
35
packages/yoastseo/spec/languageProcessing/helpers/html/replaceQuotesSpec.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import normalizeHTML from "../../../../src/languageProcessing/helpers/html/normalizeHTML"; | ||
|
|
||
| describe( "replace-quotes", function() { | ||
| describe( "normalizeHTML", function() { | ||
| it( "should return the same string when no single quotes are present", function() { | ||
| expect( normalizeHTML( "This is a test" ) ) | ||
| .toEqual( "This is a test" ); | ||
| } ); | ||
|
|
||
| it( "should return the same string when only double quotes in HTML attribute values are present", function() { | ||
| expect( normalizeHTML( "<yoastmark class=\"yoast-text-mark\">This is a test</yoastmark>" ) ) | ||
| .toEqual( "<yoastmark class=\"yoast-text-mark\">This is a test</yoastmark>" ); | ||
| } ); | ||
|
|
||
| it( "should not replace single quotes (or apostrophes) outside HTML tags", function() { | ||
| expect( normalizeHTML( "This is a test, let's go!" ) ) | ||
| .toEqual( "This is a test, let's go!" ); | ||
| } ); | ||
|
|
||
| it( "should replace the outer single quotes in HTML attribute values with double quotes", function() { | ||
| expect( normalizeHTML( "<span style='color: red'>This</span> is a test" ) ) | ||
| .toEqual( "<span style=\"color: red\">This</span> is a test" ); | ||
| } ); | ||
|
|
||
| it( "should not replace any inner single quotes in HTML attribute values", function() { | ||
| expect( normalizeHTML( "<span data-attr=\"let's go, time's up\">This</span> is a test" ) ) | ||
| .toEqual( "<span data-attr=\"let's go, time's up\">This</span> is a test" ); | ||
| } ); | ||
|
|
||
| it( "should replace the outer single quotes in multiple HTML attribute values with double quotes", function() { | ||
| expect( normalizeHTML( "<yoastmark class='yoast-text-mark' style='color: blue'>This is a test</yoastmark>" ) ) | ||
| .toEqual( "<yoastmark class=\"yoast-text-mark\" style=\"color: blue\">This is a test</yoastmark>" ); | ||
| } ); | ||
| } ); | ||
| } ); |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for CR: not sure what would be a good name for
isMaybeSingleQuoted. Suggestions would be welcome.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
isStartMarkSingleQuotedwould be more appropriate? because when it's true, we know for sure that it is single quoted (so not a "maybe" anymore)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I went with Maybe is because of the following note
// Note: if isMaybeSingleQuoted is true, this does necessary mean that the start mark is single quoted.if
startMarkIndex >= 0, this means that the doublequoted start mark is not present. This could either mean that the start mark is single quoted, or that no start mark occurs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think I misunderstood the comment then.
So, there are three cases: no start mark, single quote, and double quote.
startMarkIndex >= 0is true for single quote and false for double quote, but is it supposed to be true or false for no start mark occurs?But, if it is also true for no start mark, wouldn't it be appropriate to call the variable
isNotDoubleQuoted?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good suggestion. Will apply.