mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-12 20:13:59 +02:00
parser/pageparser: Fix when only shortcode and then summary
Fixes #5464
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user