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

ROOT_TAGS_REGEX fails to recognise mjml tag with attributes #18

Closed
samstickland opened this issue Mar 10, 2020 · 4 comments
Closed

ROOT_TAGS_REGEX fails to recognise mjml tag with attributes #18

samstickland opened this issue Mar 10, 2020 · 4 comments

Comments

@samstickland
Copy link

This is the opening MJML tag I get from a Passport export <mjml owa="desktop" version="4.5.1">

ROOT_TAGS_REGEX is /<mjml>.*<\/mjml>/mi so it fails to match.

@samstickland
Copy link
Author

Can we change the regex to this?

ROOT_TAGS_REGEX = %r{<mjml((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)/?>.*<\/mjml>}im

(based on https://haacked.com/archive/2004/10/25/usingregularexpressionstomatchhtml.aspx/)

@samstickland
Copy link
Author

Actually there might be more general compatibility issues with MJML v4?

@m-basov
Copy link
Owner

m-basov commented Mar 15, 2020

@samstickland I believe we might use something simpler for matching root tag because we don't care about the attributes. So something like <mjml[any symbol]> should do the work.I will gladly accept the PR with it if you want to help 😃

@m-basov
Copy link
Owner

m-basov commented Mar 15, 2020

@samstickland actually, it was pretty fast to fix, sorry for the late response. Please let me know if you will have any issues with MJML v4 and even better – submit the PR, they are greatly appreciated :)

@m-basov m-basov closed this as completed Mar 15, 2020
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

No branches or pull requests

2 participants