From 771cf410c86ff2b71af385dab0b5d89b1b5453e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Sun, 28 Aug 2016 22:53:04 +0300 Subject: [PATCH] Get rid of secondPass function Most of its body was redundant, as it was moved to parseRefsToAST. After removal of that code, only a single line remains, so move it out to the caller of secondPass. --- markdown.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/markdown.go b/markdown.go index c6310b4..4a156a0 100644 --- a/markdown.go +++ b/markdown.go @@ -394,8 +394,7 @@ func Parse(input []byte, opts Options) *Node { p.notes = make([]*reference, 0) } - first := firstPass(p, input) - secondPass(p, first) + p.block(firstPass(p, input)) // Walk the tree and finish up some of unfinished blocks for p.tip != nil { p.finalize(p.tip) @@ -513,29 +512,6 @@ func firstPass(p *parser, input []byte) []byte { return out.Bytes() } -// second pass: actual rendering -func secondPass(p *parser, input []byte) { - p.block(input) - - if p.flags&Footnotes != 0 && len(p.notes) > 0 { - flags := ListItemBeginningOfList - for i := 0; i < len(p.notes); i++ { - ref := p.notes[i] - if ref.hasBlock { - flags |= ListItemContainsBlock - p.block(ref.title) - } else { - p.inline(nil, ref.title) - } - flags &^= ListItemBeginningOfList | ListItemContainsBlock - } - } - - if p.nesting != 0 { - panic("Nesting level did not end at zero") - } -} - // // Link references //