FIX: smart quote edge case with quotes

This commit is contained in:
Sam 2017-07-24 12:21:49 -04:00
parent 045a2abcec
commit 40abcfc2f5
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ function trailingSpaceOnly(src, start, max) {
return true;
}
const ATTR_REGEX = /((([a-z0-9]*)\s*)=)(["'].*["']|\S+)/ig;
const ATTR_REGEX = /((([a-z0-9]*)\s*)=)(["“”'].*["“”']|\S+)/ig;
// parse a tag [test a=1 b=2] to a data structure
// {tag: "test", attrs={a: "1", b: "2"}
@ -85,7 +85,7 @@ export function parseBBCodeTag(src, start, max, multiline) {
if (val) {
val = val.trim();
val = val.replace(/^["'](.*)["']$/, '$1');
val = val.replace(/^["'“”](.*)["'“”]$/, '$1');
attrs[key] = val;
}
}

View File

@ -52,9 +52,9 @@ describe PrettyText do
expect(cook("[quote=\"EvilTrout, post:2, topic:#{topic.id}\"]\nddd\n[/quote]", topic_id: 1)).to eq(n(expected))
end
it "produces a quote even with new lines in it" do
it "indifferent about curlies" do
md = <<~MD
[quote="#{user.username}, post:123, topic:456, full:true"]
[quote=#{user.username}, post:123, topic:456, full:true”]
ddd