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

Allow shortcodes inside script tags. Fixes #4332. #4333

Merged
merged 2 commits into from Jun 25, 2015

Conversation

sminnee
Copy link
Member

@sminnee sminnee commented Jun 22, 2015

This change will ensure that short tagnames have to start with a letter or _, rather than starting with a number. This stops '[2]' from being a legal shortcode.

Although this is one way of fixing the bug identified in 4332, it would be good to confirm whether it is the best fix.

@sminnee
Copy link
Member Author

sminnee commented Jun 22, 2015

Upon reflection, it might be better to take a different approach with this, and instead only transform shortcodes if thet have a shortcode parser actually registered.

Has this been discussed before?

Sam Minnee added 2 commits June 22, 2015 11:29
The problem is that the marker images aren’t picked up by DOMDocument
if they are inserted into a <script> tag, due to the semantics of HTML.

This fix does an additional replacement after the marker images are
replaced in this way to pick up any leftover tags.
error_behaviour = self::LEAVE is the default behaviour. In this case,
we don’t even need to bother recognising such tags. Rather than
replacing with marker images and re-inserting the original text after
we’re done, we can leave them alone.

This should make the code faster and more reliable.
@sminnee
Copy link
Member Author

sminnee commented Jun 22, 2015

OK, I take back my previous comments. It has been discussed before, and implemented. The actual bug here was to do with <script> tags. Fix pushed and, since it's a low-risk bugfix, should be okay for 3.1.

@sminnee sminnee changed the title Don't allow shortcodes that start with a numbers. Fixes #4332. Allow shortcodes inside script tags. Fixes #4332. Jun 22, 2015
hafriedlander pushed a commit that referenced this pull request Jun 25, 2015
Allow shortcodes inside script tags. Fixes #4332.
@hafriedlander hafriedlander merged commit f5d6f20 into silverstripe:3.1 Jun 25, 2015
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

Successfully merging this pull request may close these issues.

None yet

3 participants