From f3386eb8498907af0d96472f3c75637e3badabf2 Mon Sep 17 00:00:00 2001 From: Russ Ross Date: Tue, 31 May 2011 11:49:49 -0600 Subject: [PATCH] gofmt --- block.go | 2 +- html.go | 6 +++--- inline.go | 32 ++++++++++++++++---------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/block.go b/block.go index f95675e..1e1aa55 100644 --- a/block.go +++ b/block.go @@ -754,7 +754,7 @@ func blockCode(out *bytes.Buffer, rndr *render, data []byte) int { n++ } if n > 0 { - work.Truncate(len(workbytes)-n) + work.Truncate(len(workbytes) - n) } work.WriteByte('\n') diff --git a/html.go b/html.go index 8ad41ce..a1fcd46 100644 --- a/html.go +++ b/html.go @@ -35,7 +35,7 @@ const ( ) type htmlOptions struct { - flags int + flags int closeTag string // how to end singleton tags: usually " />\n", possibly ">\n" tocData struct { headerCount int @@ -427,10 +427,10 @@ func htmlAutoLink(out *bytes.Buffer, link []byte, kind int, opaque interface{}) * an actual URI, e.g. `mailto:foo@bar.com`, we don't * want to print the `mailto:` prefix */ - switch { + switch { case bytes.HasPrefix(link, []byte("mailto://")): attrEscape(out, link[9:]) - case bytes.HasPrefix(link, []byte("mailto:")): + case bytes.HasPrefix(link, []byte("mailto:")): attrEscape(out, link[7:]) default: attrEscape(out, link) diff --git a/inline.go b/inline.go index 0f3c068..6fbd369 100644 --- a/inline.go +++ b/inline.go @@ -536,19 +536,19 @@ func inlineEntity(out *bytes.Buffer, rndr *render, data []byte, offset int) int } func inlineAutoLink(out *bytes.Buffer, rndr *render, data []byte, offset int) int { - // quick check to rule out most false hits on ':' - if len(data) < offset + 3 || data[offset+1] != '/' || data[offset+2] != '/' { - return 0 - } + // quick check to rule out most false hits on ':' + if len(data) < offset+3 || data[offset+1] != '/' || data[offset+2] != '/' { + return 0 + } - // scan backward for a word boundary - rewind := 0 - for offset - rewind > 0 && rewind <= 7 && !isspace(data[offset-rewind-1]) && !isspace(data[offset-rewind-1]) { - rewind++ - } - if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters - return 0 - } + // scan backward for a word boundary + rewind := 0 + for offset-rewind > 0 && rewind <= 7 && !isspace(data[offset-rewind-1]) && !isspace(data[offset-rewind-1]) { + rewind++ + } + if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters + return 0 + } orig_data := data data = data[offset-rewind:] @@ -626,10 +626,10 @@ func inlineAutoLink(out *bytes.Buffer, rndr *render, data []byte, offset int) in } } - // we were triggered on the ':', so we need to rewind the output a bit - if out.Len() >= rewind { - out.Truncate(len(out.Bytes()) - rewind) - } + // we were triggered on the ':', so we need to rewind the output a bit + if out.Len() >= rewind { + out.Truncate(len(out.Bytes()) - rewind) + } if rndr.mk.AutoLink != nil { var u_link bytes.Buffer