Fix typographical error in thematic break parser

This commit is contained in:
Dmitry Kotik 2023-10-21 10:18:06 +02:00
parent 6442ae1259
commit 686e68d8bd

View file

@ -6,15 +6,15 @@ import (
"github.com/yuin/goldmark/util" "github.com/yuin/goldmark/util"
) )
type thematicBreakPraser struct { type thematicBreakParser struct {
} }
var defaultThematicBreakPraser = &thematicBreakPraser{} var defaultthematicBreakParser = &thematicBreakParser{}
// NewThematicBreakParser returns a new BlockParser that // NewThematicBreakParser returns a new BlockParser that
// parses thematic breaks. // parses thematic breaks.
func NewThematicBreakParser() BlockParser { func NewThematicBreakParser() BlockParser {
return defaultThematicBreakPraser return defaultthematicBreakParser
} }
func isThematicBreak(line []byte, offset int) bool { func isThematicBreak(line []byte, offset int) bool {
@ -45,11 +45,11 @@ func isThematicBreak(line []byte, offset int) bool {
return count > 2 return count > 2
} }
func (b *thematicBreakPraser) Trigger() []byte { func (b *thematicBreakParser) Trigger() []byte {
return []byte{'-', '*', '_'} return []byte{'-', '*', '_'}
} }
func (b *thematicBreakPraser) Open(parent ast.Node, reader text.Reader, pc Context) (ast.Node, State) { func (b *thematicBreakParser) Open(parent ast.Node, reader text.Reader, pc Context) (ast.Node, State) {
line, segment := reader.PeekLine() line, segment := reader.PeekLine()
if isThematicBreak(line, reader.LineOffset()) { if isThematicBreak(line, reader.LineOffset()) {
reader.Advance(segment.Len() - 1) reader.Advance(segment.Len() - 1)
@ -58,18 +58,18 @@ func (b *thematicBreakPraser) Open(parent ast.Node, reader text.Reader, pc Conte
return nil, NoChildren return nil, NoChildren
} }
func (b *thematicBreakPraser) Continue(node ast.Node, reader text.Reader, pc Context) State { func (b *thematicBreakParser) Continue(node ast.Node, reader text.Reader, pc Context) State {
return Close return Close
} }
func (b *thematicBreakPraser) Close(node ast.Node, reader text.Reader, pc Context) { func (b *thematicBreakParser) Close(node ast.Node, reader text.Reader, pc Context) {
// nothing to do // nothing to do
} }
func (b *thematicBreakPraser) CanInterruptParagraph() bool { func (b *thematicBreakParser) CanInterruptParagraph() bool {
return true return true
} }
func (b *thematicBreakPraser) CanAcceptIndentedLine() bool { func (b *thematicBreakParser) CanAcceptIndentedLine() bool {
return false return false
} }