hugolib: Fix broken manual summary handling

Fixes #5381
This commit is contained in:
Bjørn Erik Pedersen
2018-10-30 20:24:34 +01:00
parent 3a786a248d
commit b2a676f5f0
6 changed files with 146 additions and 98 deletions

View File

@@ -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)
}
}