FIX: [constructor] bbcode would cause markdown crash
This commit is contained in:
parent
3937ff0425
commit
a9e2fc59c4
|
@ -50,8 +50,10 @@ class Ruler {
|
||||||
|
|
||||||
getRuleForTag(tag) {
|
getRuleForTag(tag) {
|
||||||
this.ensureCache();
|
this.ensureCache();
|
||||||
|
if (this.cache.hasOwnProperty(tag)) {
|
||||||
return this.cache[tag];
|
return this.cache[tag];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ensureCache() {
|
ensureCache() {
|
||||||
if (this.cache) { return; }
|
if (this.cache) { return; }
|
||||||
|
|
|
@ -155,6 +155,10 @@ describe PrettyText do
|
||||||
expect(cooked).to eq(html.strip)
|
expect(cooked).to eq(html.strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "handles bbcode edge cases" do
|
||||||
|
expect(PrettyText.cook "[constructor]\ntest").to eq("<p>[constructor]<br>\ntest</p>")
|
||||||
|
end
|
||||||
|
|
||||||
it "can handle quote edge cases" do
|
it "can handle quote edge cases" do
|
||||||
expect(PrettyText.cook("[quote]abc\ntest\n[/quote]")).not_to include('aside')
|
expect(PrettyText.cook("[quote]abc\ntest\n[/quote]")).not_to include('aside')
|
||||||
expect(PrettyText.cook("[quote] \ntest\n[/quote] ")).to include('aside')
|
expect(PrettyText.cook("[quote] \ntest\n[/quote] ")).to include('aside')
|
||||||
|
|
Loading…
Reference in New Issue