-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: override output/tag delimiter, fixes #54
- Loading branch information
Showing
8 changed files
with
84 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import DelimitedToken from './delimited-token' | ||
|
||
export default class OutputToken extends DelimitedToken { | ||
constructor (raw, pos, input, file, line) { | ||
super(raw, pos, input, file, line) | ||
constructor (raw, value, pos, input, file, line) { | ||
super(raw, value, pos, input, file, line) | ||
this.type = 'output' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { expect } from 'chai' | ||
import Liquid from 'src/liquid' | ||
|
||
describe('LiquidOptions#*_delimiter_*', function () { | ||
it('should respect tag_delimiter_*', async function () { | ||
const engine = new Liquid({ | ||
tag_delimiter_left: '<%=', | ||
tag_delimiter_right: '%>' | ||
}) | ||
const html = await engine.parseAndRender('<%=if true%>foo<%=endif%> ') | ||
return expect(html).to.equal('foo ') | ||
}) | ||
it('should respect output_delimiter_*', async function () { | ||
const engine = new Liquid({ | ||
output_delimiter_left: '<<', | ||
output_delimiter_right: '>>' | ||
}) | ||
const html = await engine.parseAndRender('<< "liquid" | capitalize >>') | ||
return expect(html).to.equal('Liquid') | ||
}) | ||
it('should support trimming with tag_delimiter_* set', async function () { | ||
const engine = new Liquid({ | ||
tag_delimiter_left: '<%=', | ||
tag_delimiter_right: '%>', | ||
trim_tag_left: true, | ||
trim_tag_right: true | ||
}) | ||
const html = await engine.parseAndRender(' <%=if true%> \tfoo\t <%=endif%> ') | ||
return expect(html).to.equal('foo') | ||
}) | ||
}) |