all repos — grayfriday @ 915f7049a056d73eb3b479a446514e95adf9bb4c

blackfriday fork with a few changes

Add a test for the correct handling of escaped entities in HTML.

The sanitization code does not retain any particular escaped entities - it
parses the HTML and thus loses the information on what entities were in the
original. The result is correct UTF-8 HTML though.
Martin Probst martin@probst.io
Sat, 03 May 2014 12:34:16 +0200
commit

915f7049a056d73eb3b479a446514e95adf9bb4c

parent

8d2af3a21bd6916ee914d750900b15b7d0ba681b

1 files changed, 11 insertions(+), 0 deletions(-)

jump to
M inline_test.goinline_test.go

@@ -218,6 +218,17 @@ }

doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE|HTML_SANITIZE_OUTPUT) } +func TestQuoteEscaping(t *testing.T) { + tests := []string{ + "<p>Here are some &quot;quotes&quot;.</p>\n", + "<p>Here are some &#34;quotes&#34;.</p>\n", + + "<p>Here are some &ldquo;quotes&rdquo;.</p>\n", + "<p>Here are some \u201Cquotes\u201D.</p>\n", + } + doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE|HTML_SANITIZE_OUTPUT) +} + func TestEmphasis(t *testing.T) { var tests = []string{ "nothing inline\n",