mirror of
https://github.com/discourse/discourse.git
synced 2025-05-01 04:54:37 +08:00
FIX: smart quote edge case with quotes
This commit is contained in:
parent
045a2abcec
commit
40abcfc2f5
@ -11,7 +11,7 @@ function trailingSpaceOnly(src, start, max) {
|
|||||||
return true;
|
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
|
// 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"}
|
||||||
@ -85,7 +85,7 @@ export function parseBBCodeTag(src, start, max, multiline) {
|
|||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
val = val.trim();
|
val = val.trim();
|
||||||
val = val.replace(/^["'](.*)["']$/, '$1');
|
val = val.replace(/^["'“”](.*)["'“”]$/, '$1');
|
||||||
attrs[key] = val;
|
attrs[key] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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))
|
expect(cook("[quote=\"EvilTrout, post:2, topic:#{topic.id}\"]\nddd\n[/quote]", topic_id: 1)).to eq(n(expected))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "produces a quote even with new lines in it" do
|
it "indifferent about curlies" do
|
||||||
md = <<~MD
|
md = <<~MD
|
||||||
[quote="#{user.username}, post:123, topic:456, full:true"]
|
[quote=“#{user.username}, post:123, topic:456, full:true”]
|
||||||
|
|
||||||
ddd
|
ddd
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user