From d5a8df164b001f7f60e314b2d90aec3927b5819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Sat, 13 Apr 2013 22:21:47 +0300 Subject: [PATCH] Fix bug in isHtmlTag() Fix what seems to be a typo. j should iterate through all tagname, so it should be initialized to zero. The test exposes this bug. --- html.go | 2 +- inline_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/html.go b/html.go index d20aaab..319bb94 100644 --- a/html.go +++ b/html.go @@ -663,7 +663,7 @@ func isHtmlTag(tag []byte, tagname string) bool { i++ } - j := i + j := 0 for ; i < len(tag); i, j = i+1, j+1 { if j >= len(tagname) { break diff --git a/inline_test.go b/inline_test.go index adc87a6..fbc0eaa 100644 --- a/inline_test.go +++ b/inline_test.go @@ -63,6 +63,14 @@ func doTestsInlineParam(t *testing.T, tests []string, extensions, htmlFlags int) } } +func TestRawHtmlTag(t *testing.T) { + tests := []string{ + "zz \n", + "

zz p {}

\n", + } + doTestsInlineParam(t, tests, 0, HTML_SKIP_STYLE) +} + func TestEmphasis(t *testing.T) { var tests = []string{ "nothing inline\n",