Skip to content

Commit 1e91e46

Browse files
committed
parser/pageparser: Fix shortcode nesting regression
This reverts commit a133393. While that commit fixed a bug, it introduced a worse one. Closes #14054
1 parent 8a57d0f commit 1e91e46

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

‎parser/pageparser/pagelexer_shortcode.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,11 @@ Loop:
263263
}
264264
l.openShortcodes[word] = false
265265
lookForEnd = true
266-
} else {
267-
l.openShortcodes[word] = true
268266
}
269267

270268
l.closingState = 0
271269
l.currShortcodeName = word.Value()
270+
l.openShortcodes[word] = true
272271
l.elementStepNum++
273272
if l.isInline {
274273
l.emit(tScNameInline)

‎parser/pageparser/pageparser_shortcode_test.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ var (
2727
tstRightMD = nti(tRightDelimScWithMarkup, "%}}")
2828
tstSCClose = nti(tScClose, "/")
2929
tstSC1 = nti(tScName, "sc1")
30-
tstSCAnother = nti(tScName, "another")
3130
tstSC1Inline = nti(tScNameInline, "sc1.inline")
3231
tstSC2Inline = nti(tScNameInline, "sc2.inline")
3332
tstSC2 = nti(tScName, "sc2")
@@ -75,10 +74,6 @@ var shortCodeLexerTests = []lexerTest{
7574
tstLeftNoMD, tstSC1, tstRightNoMD, tstLeftNoMD, tstSCClose,
7675
nti(tError, "closing tag for shortcode 'another' does not match start tag"),
7776
}, nil},
78-
{"close wrong, repeated", `{{< sc1 >}}{{< another >}}{{< /another >}}{{< /another >}}`, []typeText{
79-
tstLeftNoMD, tstSC1, tstRightNoMD, tstLeftNoMD, tstSCAnother, tstRightNoMD, tstLeftNoMD, tstSCClose, tstSCAnother, tstRightNoMD, tstLeftNoMD, tstSCClose,
80-
nti(tError, "closing tag for shortcode 'another' does not match start tag"),
81-
}, nil},
8277
{"close, but no open, more", `{{< sc1 >}}{{< /sc1 >}}{{< /another >}}`, []typeText{
8378
tstLeftNoMD, tstSC1, tstRightNoMD, tstLeftNoMD, tstSCClose, tstSC1, tstRightNoMD, tstLeftNoMD, tstSCClose,
8479
nti(tError, "closing tag for shortcode 'another' does not match start tag"),

0 commit comments

Comments
 (0)