-
Notifications
You must be signed in to change notification settings - Fork 329
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 issue with ':' in mustache block quoted text #3988
base: master
Are you sure you want to change the base?
Conversation
such as style attribute assignments and attribute values
A very similar regex issue occurs with Hmm .. testing the regex in regex101 suggests it should work already, except it doesn't. |
Yeah, I didn't test those because I wasn't trying to solve for them. :) Let me see what I can find. |
Allows users to not need '\"\'' and '\'\"' to wrap values. double quotes may be used alone. Nested quotes is still supported and translated to single quotes in assignment.
this fix is in good place, just tested and it works, should go for a full testing to make sure we don't break anything else |
Consider this will have to merge with #4004 |
shared/naturalcrit/markdown.js
Outdated
@@ -828,7 +828,7 @@ const processStyleTags = (string)=>{ | |||
|
|||
const id = _.remove(tags, (tag)=>tag.startsWith('#')).map((tag)=>tag.slice(1))[0] || null; | |||
const classes = _.remove(tags, (tag)=>(!tag.includes(':')) && (!tag.includes('='))).join(' ') || null; | |||
const attributes = _.remove(tags, (tag)=>(tag.includes('='))).map((tag)=>tag.replace(/="?([^"]*)"?/g, '="$1"')) | |||
const attributes = _.remove(tags, (tag)=>(tag.includes('=')) && (tag.slice(0, tag.indexOf(':')).indexOf('=') > 0)).map((tag)=>tag.replace(/="?([^"]*)"?/g, '="$1"')) |
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.
Can you clarify what this added check is doing? I don't quite follow what case this is checking.
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 it is debris I missed from a different fix attempt. I can't see any sane reason for it not to be true if the previous test is true.
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.
Oh, figured it out. It's incorrectly constructed - I must have tested for it badly. It is meant to filter out CSS property assignments that have an =
in the string.
IE: Make sure that --myVar:"This is an = sign"
isn't treated as an HTML attribute.
There is a hard regression in here I am attempting to locate. |
@dbolack-ab Ping me when you are ready for me to merge and I will try to do it today. |
This fixes the issue with CSS Attribute assignment strings containing
:
in mustache blocksDescription
This updates the regex to permit
:
in the right side of a CSS attribute/property or HTML attribute assignment.Related Issues or Discussions
QA Instructions, Screenshots, Recordings
Should now generate
Instead of
etc. Should work for all four mustache situations.
Reviewer Checklist
*Reviewers, refer to this list when testing features, or suggest new items *