Merge pull request #1804 from chillu/pulls/shortcode-quoting

FIX Unquoted shortcodes weren't parsed (fixes #680)
This commit is contained in:
Ingo Schommer 2013-04-25 16:33:56 -07:00
commit 9b99eb9339
3 changed files with 9 additions and 9 deletions

View File

@ -151,7 +151,7 @@ class ShortcodeParser {
(?:
(?:\'([^\']+)\') | # 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() {
$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() {

View File

@ -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);