Skip to content

Commit

Permalink
Add support for newline characters in raw string shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
hcwong authored and bep committed Jan 18, 2020
1 parent 3efa1d8 commit 21ca2e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parser/pageparser/pagelexer_shortcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Loop:
openBacktickFound = true
l.ignore()
}
case r == eof, r == '\n':
case r == eof:
return l.errorf("unterminated raw string in shortcode parameter-argument: '%s'", l.current())
}
}
Expand Down
6 changes: 6 additions & 0 deletions parser/pageparser/pageparser_shortcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ var shortCodeLexerTests = []lexerTest{
tstLeftNoMD, tstSC1, nti(tScParam, "-ziL-.%QigdO-4"), tstRightNoMD, tstEOF}},
{"raw string", `{{< sc1` + "`" + "Hello World" + "`" + ` >}}`, []Item{
tstLeftNoMD, tstSC1, nti(tScParam, "Hello World"), tstRightNoMD, tstEOF}},
{"raw string with newline", `{{< sc1` + "`" + `Hello
World` + "`" + ` >}}`, []Item{
tstLeftNoMD, tstSC1, nti(tScParam, `Hello
World`), tstRightNoMD, tstEOF}},
{"raw string with escape character", `{{< sc1` + "`" + `Hello \b World` + "`" + ` >}}`, []Item{
tstLeftNoMD, tstSC1, nti(tScParam, `Hello \b World`), tstRightNoMD, tstEOF}},
{"two params", `{{< sc1 param1 param2 >}}`, []Item{
tstLeftNoMD, tstSC1, tstParam1, tstParam2, tstRightNoMD, tstEOF}},
// issue #934
Expand Down

0 comments on commit 21ca2e9

Please sign in to comment.