mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1804 from chillu/pulls/shortcode-quoting
FIX Unquoted shortcodes weren't parsed (fixes #680)
This commit is contained in:
commit
9b99eb9339
@ -151,7 +151,7 @@ class ShortcodeParser {
|
||||
(?:
|
||||
(?:\'([^\']+)\') | # Value surrounded by \'
|
||||
(?:"([^"]+)") | # Value surrounded by "
|
||||
(\w+) # Bare value
|
||||
([^\s,\]]+) # Bare value
|
||||
)
|
||||
';
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user