-
Notifications
You must be signed in to change notification settings - Fork 440
Add support for escaping characters with the date filter #432
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,12 @@ var n = new Swig(), | |
{ c: 'v|date("S")', v: makeDate(420, 2011, 8, 13), e: 'th' }, | ||
{ c: 'v|date("S")', v: makeDate(420, 2011, 8, 21), e: 'st' }, | ||
{ c: 'v|date("S")', v: makeDate(420, 2011, 8, 22), e: 'nd' }, | ||
{ c: 'v|date("S")', v: makeDate(420, 2011, 8, 23), e: 'rd' } | ||
{ c: 'v|date("S")', v: makeDate(420, 2011, 8, 23), e: 'rd' }, | ||
|
||
// Escape character | ||
{ c: 'v|date("\\D")', v: d, e: 'D' }, | ||
{ c: 'v|date("\\t\\e\\s\\t")', v: d, e: 'test' }, | ||
{ c: 'v|date("\\\\D")', v: d, e: '\\Tue' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I attempted to add a more "real-world" example, and it failed tests...
@ecaron: Do you want to fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I may have done this wrong... need the extra escapes. Will re-try later tonight... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just going to say that - you're right that they need extra escapes because the first round of slashes gets lost converting the tests to code (just like in the addslashes example.) |
||
], | ||
'default': [ | ||
{ c: 'v|default("tacos")', v: 'foo', e: 'foo' }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double-slashes are necessary here to keep the TokenParser happy when performing the tests, and are not necessary in typical use. These tests are modelled after the test styling in the addslashes checks.