diff options
Diffstat (limited to 'parser/pageparser/pagelexer.go')
-rw-r--r-- | parser/pageparser/pagelexer.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/parser/pageparser/pagelexer.go b/parser/pageparser/pagelexer.go index ddf109b3d..565be2994 100644 --- a/parser/pageparser/pagelexer.go +++ b/parser/pageparser/pagelexer.go @@ -194,6 +194,16 @@ func (l *pageLexer) consumeCRLF() bool { return consumed } +func (l *pageLexer) consumeSpace() { + for { + r := l.next() + if r == eof || !unicode.IsSpace(r) { + l.backup() + return + } + } +} + func lexMainSection(l *pageLexer) stateFunc { // Fast forward as far as possible. var l1, l2 int @@ -234,6 +244,8 @@ func lexMainSection(l *pageLexer) stateFunc { } l.summaryDividerChecked = true l.pos += len(l.summaryDivider) + // This makes it a little easier to reason about later. + l.consumeSpace() l.emit(TypeLeadSummaryDivider) } } |