FIX: bbcode regex was greedy and preventing quotes
This commit is contained in:
parent
fac4bf2f85
commit
dd76ba90b3
|
@ -11,7 +11,7 @@ function trailingSpaceOnly(src, start, max) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ATTR_REGEX = /^\s*=(.+)$|((([a-z0-9]*)\s*)=)(["“”'].*["“”']|\S+)/ig;
|
const ATTR_REGEX = /^\s*=(.+)$|((([a-z0-9]*)\s*)=)(["“”'].*?["“”']|\S+)/ig;
|
||||||
|
|
||||||
// parse a tag [test a=1 b=2] to a data structure
|
// parse a tag [test a=1 b=2] to a data structure
|
||||||
// {tag: "test", attrs={a: "1", b: "2"}
|
// {tag: "test", attrs={a: "1", b: "2"}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { parseBBCodeTag } from 'pretty-text/engines/discourse-markdown/bbcode-block';
|
||||||
|
|
||||||
|
QUnit.module("lib:pretty-text:bbcode");
|
||||||
|
|
||||||
|
QUnit.test("block with multiple quoted attributes", assert => {
|
||||||
|
const parsed = parseBBCodeTag('[test one="foo" two="bar bar"]', 0, 30);
|
||||||
|
|
||||||
|
assert.equal(parsed.tag, "test");
|
||||||
|
assert.equal(parsed.attrs.one, "foo");
|
||||||
|
assert.equal(parsed.attrs.two, "bar bar");
|
||||||
|
});
|
Loading…
Reference in New Issue