diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index e71286490..16b3bd770 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -370,7 +370,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; // All other attributes switch(this.find(':input[name=LinkType]:checked').val()) { case 'internal': - href = '[sitetree_link id=' + this.find(':input[name=internal]').val() + ']'; + href = '[sitetree_link,id=' + this.find(':input[name=internal]').val() + ']'; if(anchor) href += '#' + anchor; break; @@ -379,7 +379,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; break; case 'file': - href = '[file_link id=' + this.find(':input[name=file]').val() + ']'; + href = '[file_link,id=' + this.find(':input[name=file]').val() + ']'; target = '_blank'; break; diff --git a/parsers/ShortcodeParser.php b/parsers/ShortcodeParser.php index eb62777eb..1ade0864d 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -170,10 +170,9 @@ class ShortcodeParser { if($prefix == '[' && $suffix == ']') { return substr($matches[0], 1, -1); } - $attributes = array(); // Parse attributes into into this array. - if(preg_match_all('/(\w+) *= *(?:([\'"])(.*?)\\2|([^ "\'>]+))/', $matches[3], $match, PREG_SET_ORDER)) { + if(preg_match_all('/(\w+) *= *(?:([\'"])(.*?)\\2|([^ ,"\'>]+))/', $matches[3], $match, PREG_SET_ORDER)) { foreach($match as $attribute) { if(!empty($attribute[4])) { $attributes[strtolower($attribute[1])] = $attribute[4]; @@ -186,4 +185,4 @@ class ShortcodeParser { return $prefix . call_user_func($this->shortcodes[$shortcode], $attributes, $matches[5], $this, $shortcode) . $suffix; } -} \ No newline at end of file +} diff --git a/tests/parsers/ShortcodeParserTest.php b/tests/parsers/ShortcodeParserTest.php index 4b8ac5319..f826a2030 100644 --- a/tests/parsers/ShortcodeParserTest.php +++ b/tests/parsers/ShortcodeParserTest.php @@ -82,14 +82,14 @@ class ShortcodeParserTest extends SapphireTest { } public function testUnquotedArguments() { - $this->assertEquals('', $this->parser->parse('[test_shortcode foo=bar baz = buz]')); + $this->assertEquals('', $this->parser->parse('[test_shortcode,foo=bar,baz = buz]')); $this->assertEquals(array('foo' => 'bar', 'baz' => 'buz'), $this->arguments); } public function testSelfClosingTag() { $this->assertEquals ( 'morecontent', - $this->parser->parse('[test_shortcode id="1"/]more[test_shortcode id="2"]content[/test_shortcode]'), + $this->parser->parse('[test_shortcode,id="1"/]more[test_shortcode,id="2"]content[/test_shortcode]'), 'Assert that self-closing tags are respected during parsing.' ); @@ -109,4 +109,4 @@ class ShortcodeParserTest extends SapphireTest { return $content; } -} \ No newline at end of file +}