mirror of
https://github.com/discourse/discourse.git
synced 2025-04-11 00:02:25 +08:00
BUGFIX: newline after bold was not producting a BR
This commit is contained in:
parent
dd8a06187a
commit
b8357aa90a
@ -21,11 +21,9 @@ Discourse.Dialect.postProcessText(function (text, event) {
|
|||||||
if (split.length) {
|
if (split.length) {
|
||||||
var replacement = [];
|
var replacement = [];
|
||||||
for (var i=0; i<split.length; i++) {
|
for (var i=0; i<split.length; i++) {
|
||||||
if (split[i].length > 0) {
|
if (split[i].length > 0) { replacement.push(split[i]); }
|
||||||
replacement.push(split[i]);
|
|
||||||
if (i !== split.length-1) { replacement.push(['br']); }
|
if (i !== split.length-1) { replacement.push(['br']); }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return replacement;
|
return replacement;
|
||||||
}
|
}
|
||||||
|
@ -240,4 +240,19 @@ describe PrettyText do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe "markdown quirks" do
|
||||||
|
it "allows for newline after bold" do
|
||||||
|
PrettyText.cook("**hello**\nworld").should match_html "<p><strong>hello</strong><br />world</p>"
|
||||||
|
end
|
||||||
|
it "allows for newline for 2 bolds" do
|
||||||
|
PrettyText.cook("**hello**\n**world**").should match_html "<p><strong>hello</strong><br /><strong>world</strong></p>"
|
||||||
|
end
|
||||||
|
|
||||||
|
pending "does not break a streak for mentions" do
|
||||||
|
Fabricate(:user, username: 'sam')
|
||||||
|
PrettyText.cook("<small>a @sam c</small>").should match_html "<p><small>a <a class='mention' href='/users/sam'>@sam</a> c</small></p>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -5,11 +5,11 @@ describe PostAnalyzer do
|
|||||||
let(:default_topic_id) { 12 }
|
let(:default_topic_id) { 12 }
|
||||||
|
|
||||||
describe '#cook' do
|
describe '#cook' do
|
||||||
let(:post_analyzer) { described_class.new nil, nil }
|
let(:post_analyzer) {PostAnalyzer.new nil, nil }
|
||||||
|
|
||||||
let(:args) { [raw, options] }
|
|
||||||
let(:raw) { "Here's a tweet:\n#{url}" }
|
let(:raw) { "Here's a tweet:\n#{url}" }
|
||||||
let(:options) { {} }
|
let(:options) { {} }
|
||||||
|
let(:args) { [raw, options] }
|
||||||
|
|
||||||
let(:url) {
|
let(:url) {
|
||||||
'https://twitter.com/evil_trout/status/345954894420787200'
|
'https://twitter.com/evil_trout/status/345954894420787200'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user