Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ee80701f
authored
11 years ago
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Allow template delimiters as a second option to the TextTemplateParser.parse function. [#181]
1 parent
51c50695
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
src/rivets.coffee
src/rivets.coffee
View file @
ee80701
...
...
@@ -292,14 +292,14 @@ class Rivets.TextTemplateParser
# Parses the template and returns a set of tokens, separating static portions
# of text from binding declarations.
@
parse
:
(
template
)
->
@
parse
:
(
template
,
delimiters
)
->
tokens
=
[]
length
=
template
.
length
index
=
0
lastIndex
=
0
while
lastIndex
<
length
index
=
template
.
indexOf
'{{'
,
lastIndex
index
=
template
.
indexOf
delimiters
[
0
]
,
lastIndex
if
index
<
0
tokens
.
push
type
:
@
types
.
text
,
value
:
template
.
slice
lastIndex
...
...
@@ -309,7 +309,7 @@ class Rivets.TextTemplateParser
tokens
.
push
type
:
@
types
.
text
,
value
:
template
.
slice
lastIndex
,
index
lastIndex
=
index
+
2
index
=
template
.
indexOf
'}}'
,
lastIndex
index
=
template
.
indexOf
delimiters
[
1
]
,
lastIndex
if
index
<
0
substring
=
template
.
slice
lastIndex
-
2
...
...
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment