Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
parseRule: treat the occurrence of a parse error as a valid condition
Browse files Browse the repository at this point in the history
The previous implementation was too strict. A parse error can
occur if the input is a single line consisting of spaces and tabs only.
  • Loading branch information
knieriem committed May 29, 2012
1 parent ee7958c commit 6402ae5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions markdown.go
Expand Up @@ -81,6 +81,9 @@ func (p *Parser) Markdown(src io.Reader, f Formatter) {
L:
for {
tree := p.parseRule(ruleDocblock, s)
if tree == nil {
break
}
s = p.yy.ResetBuffer("")
tree = p.processRawBlocks(tree)
f.FormatBlock(tree)
Expand All @@ -97,12 +100,12 @@ func (p *Parser) parseRule(rule int, s string) (tree *element) {
if p.yy.ResetBuffer(s) != "" {
log.Fatalf("Buffer not empty")
}
if err := p.yy.Parse(rule); err != nil {
log.Fatalln("markdown:", err)
}
err := p.yy.Parse(rule)
switch rule {
case ruleDoc, ruleDocblock:
tree = p.yy.state.tree
if err == nil {
tree = p.yy.state.tree
}
p.yy.state.tree = nil
}
return
Expand Down

0 comments on commit 6402ae5

Please sign in to comment.