Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
e4175d4b
Commit
e4175d4b
authored
Dec 31, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed "pos" to "end_index".
parent
021ab20a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
pystache/template.py
+10
-10
No files found.
pystache/template.py
View file @
e4175d4b
...
...
@@ -164,20 +164,20 @@ class Template(object):
# Save the literal text content.
buffer
.
append
(
captures
[
'content'
])
pos
=
match
.
end
()
end_index
=
match
.
end
()
tagPos
=
match
.
end
(
'content'
)
# Standalone (non-interpolation) tags consume the entire line,
# both leading whitespace and trailing newline.
tagBeganLine
=
not
tagPos
or
template
[
tagPos
-
1
]
in
[
'
\r
'
,
'
\n
'
]
tagEndedLine
=
(
pos
==
len
(
template
)
or
template
[
pos
]
in
[
'
\r
'
,
'
\n
'
])
tagEndedLine
=
(
end_index
==
len
(
template
)
or
template
[
end_index
]
in
[
'
\r
'
,
'
\n
'
])
interpolationTag
=
captures
[
'tag'
]
in
[
''
,
'&'
,
'{'
]
if
(
tagBeganLine
and
tagEndedLine
and
not
interpolationTag
):
if
pos
<
len
(
template
):
pos
+=
template
[
pos
]
==
'
\r
'
and
1
or
0
if
pos
<
len
(
template
):
pos
+=
template
[
pos
]
==
'
\n
'
and
1
or
0
if
end_index
<
len
(
template
):
end_index
+=
template
[
end_index
]
==
'
\r
'
and
1
or
0
if
end_index
<
len
(
template
):
end_index
+=
template
[
end_index
]
==
'
\n
'
and
1
or
0
elif
captures
[
'whitespace'
]:
buffer
.
append
(
captures
[
'whitespace'
])
tagPos
+=
len
(
captures
[
'whitespace'
])
...
...
@@ -193,16 +193,16 @@ class Template(object):
buffer
.
append
(
partialTag
(
name
,
captures
[
'whitespace'
]))
elif
captures
[
'tag'
]
in
[
'#'
,
'^'
]:
try
:
self
.
parse_to_tree
(
template
,
index
=
pos
)
self
.
parse_to_tree
(
template
,
index
=
end_index
)
except
EndOfSection
as
e
:
bufr
=
e
.
buffer
tmpl
=
e
.
template
pos
=
e
.
position
end_index
=
e
.
position
tag
=
{
'#'
:
sectionTag
,
'^'
:
inverseTag
}[
captures
[
'tag'
]]
buffer
.
append
(
tag
(
name
,
bufr
,
tmpl
,
(
self
.
otag
,
self
.
ctag
)))
elif
captures
[
'tag'
]
==
'/'
:
raise
EndOfSection
(
buffer
,
template
[
start_index
:
tagPos
],
pos
)
raise
EndOfSection
(
buffer
,
template
[
start_index
:
tagPos
],
end_index
)
elif
captures
[
'tag'
]
in
[
'{'
,
'&'
]:
buffer
.
append
(
unescapedTag
(
name
,
(
self
.
otag
,
self
.
ctag
)))
elif
captures
[
'tag'
]
==
''
:
...
...
@@ -210,7 +210,7 @@ class Template(object):
else
:
raise
Exception
(
"'
%
s' is an unrecognized type!"
%
captures
[
'tag'
])
return
pos
return
end_index
def
render
(
self
,
encoding
=
None
):
result
=
render
(
self
.
template
,
self
.
view
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment