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
cb8c06ca
Commit
cb8c06ca
authored
Dec 31, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed variables in the parse_to_tree() method.
parent
c2500342
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
pystache/template.py
+9
-7
No files found.
pystache/template.py
View file @
cb8c06ca
...
@@ -134,23 +134,25 @@ class Template(object):
...
@@ -134,23 +134,25 @@ class Template(object):
self
.
tag_re
=
re
.
compile
(
tag
%
tags
,
re
.
M
|
re
.
X
)
self
.
tag_re
=
re
.
compile
(
tag
%
tags
,
re
.
M
|
re
.
X
)
def
parse_to_tree
(
self
,
template
,
index
=
0
):
def
parse_to_tree
(
self
,
template
,
index
=
0
):
"""Parse a template into a syntax tree."""
"""
Parse a template into a syntax tree.
buffer
=
[]
"""
pos
=
index
parse_tree
=
[]
start_index
=
index
while
True
:
while
True
:
match
=
self
.
tag_re
.
search
(
template
,
pos
)
match
=
self
.
tag_re
.
search
(
template
,
index
)
if
match
is
None
:
if
match
is
None
:
break
break
pos
=
self
.
_handle_match
(
template
,
match
,
buffer
,
index
)
index
=
self
.
_handle_match
(
template
,
match
,
parse_tree
,
start_
index
)
# Save the rest of the template.
# Save the rest of the template.
buffer
.
append
(
template
[
pos
:])
parse_tree
.
append
(
template
[
index
:])
return
buffer
return
parse_tree
def
_handle_match
(
self
,
template
,
match
,
buffer
,
index
):
def
_handle_match
(
self
,
template
,
match
,
buffer
,
index
):
# Normalize the captures dictionary.
# Normalize the captures dictionary.
...
...
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