parser/pageparser: Fix when only shortcode and then summary

Fixes #5464
This commit is contained in:
Bjørn Erik Pedersen
2018-11-24 17:06:26 +01:00
parent dcfeed35c6
commit 94ab125b27
4 changed files with 26 additions and 9 deletions

View File

@@ -216,7 +216,7 @@ func lexMainSection(l *pageLexer) stateFunc {
}
l2 = l.index(leftDelimSc)
skip := minPositiveIndex(l1, l2)
skip := minIndex(l1, l2)
if skip > 0 {
l.pos += skip
@@ -730,12 +730,12 @@ func (l *pageLexer) currentRightShortcodeDelim() []byte {
// helper functions
// returns the min index > 0
func minPositiveIndex(indices ...int) int {
// returns the min index >= 0
func minIndex(indices ...int) int {
min := -1
for _, j := range indices {
if j <= 0 {
if j < 0 {
continue
}
if min == -1 {