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.
Vytautas Ĺ altenis vytas@rtfb.lt
Sun, 28 Aug 2016 22:53:04 +0300
1 files changed,
1 insertions(+),
25 deletions(-)
jump to
M
markdown.go
→
markdown.go
@@ -394,8 +394,7 @@ if extensions&Footnotes != 0 {
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)@@ -511,29 +510,6 @@ out.WriteByte('\n')
} 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") - } } //