FIX Unquoted shortcodes weren't parsed (fixes #680)

Since that used to be the default shortcode notation
for our core "insert media" functionality, its important
to have this fixed and keep supporting "legacy" content
created with 3.0.
This commit is contained in:
Ingo Schommer 2013-04-26 01:00:13 +02:00
parent a6b0807b9f
commit 0e5b099287
3 changed files with 9 additions and 9 deletions

View File

@ -151,7 +151,7 @@ class ShortcodeParser {
(?: (?:
(?:\'([^\']+)\') | # Value surrounded by \' (?:\'([^\']+)\') | # Value surrounded by \'
(?:"([^"]+)") | # Value surrounded by " (?:"([^"]+)") | # Value surrounded by "
(\w+) # Bare value ([^\s,\]]+) # Bare value
) )
'; ';

View File

@ -150,13 +150,13 @@ class ShortcodeParserTest extends SapphireTest {
} }
public function testUnquotedArguments() { public function testUnquotedArguments() {
$this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar,baz = buz]')); $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar!,baz = buz123]'));
$this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments); $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments);
} }
public function testSpacesForDelimiter() { public function testSpacesForDelimiter() {
$this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar baz = buz]')); $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar! baz = buz123]'));
$this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments); $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments);
} }
public function testSelfClosingTag() { public function testSelfClosingTag() {

View File

@ -62,10 +62,10 @@
var content = jQuery(o.content); var content = jQuery(o.content);
content.find('.ss-htmleditorfield-file.embed').each(function() { content.find('.ss-htmleditorfield-file.embed').each(function() {
var el = jQuery(this); var el = jQuery(this);
var shortCode = '[embed width=' + el.data('width') var shortCode = '[embed width="' + el.data('width') + '"'
+ ' height=' + el.data('height') + ' height="' + el.data('height') + '"'
+ ' class=' + el.data('cssclass') + ' class="' + el.data('cssclass') + '"'
+ ' thumbnail=' + el.data('thumbnail') + ' thumbnail="' + el.data('thumbnail') + '"'
+ ']' + el.data('url') + ']' + el.data('url')
+ '[/embed]'; + '[/embed]';
el.replaceWith(shortCode); el.replaceWith(shortCode);