Permalink
Browse files

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.
  • Loading branch information...
1 parent a6b0807 commit 0e5b099287539736f8a906b75a030441afa4918c @chillu chillu committed Apr 25, 2013
@@ -151,7 +151,7 @@ protected function insertListAfter($new, $after) {
(?:
(?:\'([^\']+)\') | # Value surrounded by \'
(?:"([^"]+)") | # Value surrounded by "
- (\w+) # Bare value
+ ([^\s,\]]+) # Bare value
)
';
@@ -150,13 +150,13 @@ public function testShortcodeEscaping() {
}
public function testUnquotedArguments() {
- $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar,baz = buz]'));
- $this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments);
+ $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar!,baz = buz123]'));
+ $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments);
}
public function testSpacesForDelimiter() {
- $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar baz = buz]'));
- $this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments);
+ $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar! baz = buz123]'));
+ $this->assertEquals(array('foo' => 'bar!', 'baz' => 'buz123'), $this->arguments);
}
public function testSelfClosingTag() {
@@ -62,10 +62,10 @@
var content = jQuery(o.content);
content.find('.ss-htmleditorfield-file.embed').each(function() {
var el = jQuery(this);
- var shortCode = '[embed width=' + el.data('width')
- + ' height=' + el.data('height')
- + ' class=' + el.data('cssclass')
- + ' thumbnail=' + el.data('thumbnail')
+ var shortCode = '[embed width="' + el.data('width') + '"'
+ + ' height="' + el.data('height') + '"'
+ + ' class="' + el.data('cssclass') + '"'
+ + ' thumbnail="' + el.data('thumbnail') + '"'
+ ']' + el.data('url')
+ '[/embed]';
el.replaceWith(shortCode);

0 comments on commit 0e5b099

Please sign in to comment.