From ad8452c77c3562e91764de919129cc6b829eebc8 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 19 Aug 2015 15:10:17 +0900 Subject: [PATCH] Simplification --- vimdoc.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/vimdoc.go b/vimdoc.go index 642510f..fae0b84 100644 --- a/vimdoc.go +++ b/vimdoc.go @@ -88,18 +88,6 @@ func VimDocRenderer(filename, desc string, cols, tabs, flags int) blackfriday.Re tocPos: -1} } -func (v *vimDoc) pushl() { - v.lists = append(v.lists, &list{1}) -} - -func (v *vimDoc) popl() { - v.lists = v.lists[:len(v.lists)-1] -} - -func (v *vimDoc) getl() *list { - return v.lists[len(v.lists)-1] -} - func (v *vimDoc) fixupCode(input []byte) []byte { r := regexp.MustCompile(`(?m)^\s*([<>])$`) return r.ReplaceAll(input, []byte("$1")) @@ -241,15 +229,15 @@ func (v *vimDoc) HRule(out *bytes.Buffer) { } func (v *vimDoc) List(out *bytes.Buffer, text func() bool, flags int) { - v.pushl() + v.lists = append(v.lists, &list{1}) text() - v.popl() + v.lists = v.lists[:len(v.lists)-1] } func (v *vimDoc) ListItem(out *bytes.Buffer, text []byte, flags int) { marker := out.Len() - list := v.getl() + list := v.lists[len(v.lists)-1] if flags&blackfriday.LIST_TYPE_ORDERED == blackfriday.LIST_TYPE_ORDERED { out.WriteString(fmt.Sprintf("%d. ", list.index)) list.index++