FIX: compensate for typographer
typographer can change " to ” leading to breakages in parser At least codify this. Longer term we want to re-prioritize typographer so it always runs after bbcode parsing.
This commit is contained in:
parent
a91ee45de9
commit
cba5baa427
|
@ -15,7 +15,7 @@ function trailingSpaceOnly(src, start, max) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ATTR_REGEX = /^\s*=(.+)$|((([a-z0-9]*)\s*)=)([“”].*?[“”]|['].*[']|["].*?["]|\S+)/gi;
|
const ATTR_REGEX = /^\s*=(.+)$|((([a-z0-9]*)\s*)=)([“”"][^“”"]*[“”"]|['][^']*[']|[^"'“”]\S*)/gi;
|
||||||
|
|
||||||
// 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"}
|
||||||
|
|
|
@ -1711,17 +1711,20 @@ HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
it "wraps the [wrap] tag in block" do
|
it "wraps the [wrap] tag in block" do
|
||||||
|
# can interfere with parsing
|
||||||
|
SiteSetting.enable_markdown_typographer = true
|
||||||
|
|
||||||
md = <<~MD
|
md = <<~MD
|
||||||
[wrap=toc]
|
[wrap=toc id="a” aa='b"' bb="f'"]
|
||||||
taco
|
taco1
|
||||||
[/wrap]
|
[/wrap]
|
||||||
MD
|
MD
|
||||||
|
|
||||||
cooked = PrettyText.cook(md)
|
cooked = PrettyText.cook(md)
|
||||||
|
|
||||||
html = <<~HTML
|
html = <<~HTML
|
||||||
<div class="d-wrap" data-wrap="toc">
|
<div class="d-wrap" data-wrap="toc" data-id="a" data-aa="b&quot;" data-bb="f'">
|
||||||
<p>taco</p>
|
<p>taco1</p>
|
||||||
</div>
|
</div>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue