mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
@@ -464,6 +464,8 @@ Loop:
|
|||||||
for {
|
for {
|
||||||
switch r := l.next(); {
|
switch r := l.next(); {
|
||||||
case isAlphaNumericOrHyphen(r):
|
case isAlphaNumericOrHyphen(r):
|
||||||
|
// Allow forward slash inside names to make it possible to create namespaces.
|
||||||
|
case r == '/':
|
||||||
default:
|
default:
|
||||||
l.backup()
|
l.backup()
|
||||||
word := l.input[l.start:l.pos]
|
word := l.input[l.start:l.pos]
|
||||||
|
@@ -33,6 +33,7 @@ var (
|
|||||||
tstSC1 = item{tScName, 0, "sc1"}
|
tstSC1 = item{tScName, 0, "sc1"}
|
||||||
tstSC2 = item{tScName, 0, "sc2"}
|
tstSC2 = item{tScName, 0, "sc2"}
|
||||||
tstSC3 = item{tScName, 0, "sc3"}
|
tstSC3 = item{tScName, 0, "sc3"}
|
||||||
|
tstSCSlash = item{tScName, 0, "sc/sub"}
|
||||||
tstParam1 = item{tScParam, 0, "param1"}
|
tstParam1 = item{tScParam, 0, "param1"}
|
||||||
tstParam2 = item{tScParam, 0, "param2"}
|
tstParam2 = item{tScParam, 0, "param2"}
|
||||||
tstVal = item{tScParamVal, 0, "Hello World"}
|
tstVal = item{tScParamVal, 0, "Hello World"}
|
||||||
@@ -45,6 +46,8 @@ var shortCodeLexerTests = []shortCodeLexerTest{
|
|||||||
{"no markup", `{{< sc1 >}}`, []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
{"no markup", `{{< sc1 >}}`, []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
||||||
{"with EOL", "{{< sc1 \n >}}", []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
{"with EOL", "{{< sc1 \n >}}", []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
||||||
|
|
||||||
|
{"forward slash inside name", `{{< sc/sub >}}`, []item{tstLeftNoMD, tstSCSlash, tstRightNoMD, tstEOF}},
|
||||||
|
|
||||||
{"simple with markup", `{{% sc1 %}}`, []item{tstLeftMD, tstSC1, tstRightMD, tstEOF}},
|
{"simple with markup", `{{% sc1 %}}`, []item{tstLeftMD, tstSC1, tstRightMD, tstEOF}},
|
||||||
{"with spaces", `{{< sc1 >}}`, []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
{"with spaces", `{{< sc1 >}}`, []item{tstLeftNoMD, tstSC1, tstRightNoMD, tstEOF}},
|
||||||
{"mismatched rightDelim", `{{< sc1 %}}`, []item{tstLeftNoMD, tstSC1,
|
{"mismatched rightDelim", `{{< sc1 %}}`, []item{tstLeftNoMD, tstSC1,
|
||||||
|
Reference in New Issue
Block a user