cosmetics

This commit is contained in:
Michael Teichgräber 2012-04-30 00:58:06 +02:00
parent 4071eb731f
commit 1bbd55c017
2 changed files with 4 additions and 3 deletions

View File

@ -160,8 +160,8 @@ func (p *Parser) preformat(r io.Reader) (s string) {
break break
} }
i0 := 0 i0 := 0
for i := range buf[:n] { for i, c := range buf[:n] {
switch buf[i] { switch c {
case '\t': case '\t':
b.Write(buf[i0:i]) b.Write(buf[i0:i])
for ; charstotab > 0; charstotab-- { for ; charstotab > 0; charstotab-- {

View File

@ -86,6 +86,7 @@ func (w *htmlOut) str(s string) *htmlOut {
var ws string var ws string
var i0 = 0 var i0 = 0
o := w.obfuscate
for i, r := range s { for i, r := range s {
switch r { switch r {
case '&': case '&':
@ -97,7 +98,7 @@ func (w *htmlOut) str(s string) *htmlOut {
case '"': case '"':
ws = """ ws = """
default: default:
if w.obfuscate { if o {
if rand.Intn(2) == 0 { if rand.Intn(2) == 0 {
ws = fmt.Sprintf("&#%d;", r) ws = fmt.Sprintf("&#%d;", r)
} else { } else {