all repos — grayfriday @ a2fda5e98fedf99810df6fb0f5877988795a3733

blackfriday fork with a few changes

Extract repetitive code to a func
Vytautas Ĺ altenis Vytautas.Shaltenis@gmail.com
Sat, 13 Apr 2013 22:26:29 +0300
commit

a2fda5e98fedf99810df6fb0f5877988795a3733

parent

d5a8df164b001f7f60e314b2d90aec3927b5819c

1 files changed, 9 insertions(+), 7 deletions(-)

jump to
M html.gohtml.go

@@ -651,18 +651,13 @@ if i < len(tag) && tag[0] != '<' {

return false } i++ - for i < len(tag) && isspace(tag[i]) { - i++ - } + i = skipSpace(tag, i) if i < len(tag) && tag[i] == '/' { i++ } - for i < len(tag) && isspace(tag[i]) { - i++ - } - + i = skipSpace(tag, i) j := 0 for ; i < len(tag); i, j = i+1, j+1 { if j >= len(tagname) {

@@ -679,6 +674,13 @@ return false

} return isspace(tag[i]) || tag[i] == '>' +} + +func skipSpace(tag []byte, i int) int { + for i < len(tag) && isspace(tag[i]) { + i++ + } + return i } func doubleSpace(out *bytes.Buffer) {