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
2de83f87
Commit
2de83f87
authored
May 05, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring parser: removed a local variable (index) from parse().
parent
ce1b81b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
pystache/parser.py
+5
-6
No files found.
pystache/parser.py
View file @
2de83f87
...
...
@@ -97,12 +97,11 @@ class Parser(object):
"""
parse_tree
=
[]
index
=
start_index
content_end_index
,
parsed_section
=
None
,
None
while
True
:
match
=
self
.
_template_re
.
search
(
template
,
index
)
match
=
self
.
_template_re
.
search
(
template
,
start_
index
)
if
match
is
None
:
break
...
...
@@ -110,7 +109,7 @@ class Parser(object):
match_index
=
match
.
start
()
end_index
=
match
.
end
()
before_tag
=
template
[
index
:
match_index
]
before_tag
=
template
[
start_
index
:
match_index
]
parse_tree
.
append
(
before_tag
)
...
...
@@ -149,9 +148,9 @@ class Parser(object):
return
end_index
,
match_index
,
ParsedTemplate
(
parse_tree
)
if
tag_type
in
(
'#'
,
'^'
):
index
,
content_end_index
,
parsed_section
=
self
.
parse
(
template
,
end_index
,
tag_key
)
start_
index
,
content_end_index
,
parsed_section
=
self
.
parse
(
template
,
end_index
,
tag_key
)
else
:
index
=
end_index
start_
index
=
end_index
# Variable index is now the next character to process.
node
=
self
.
_make_node
(
template
,
tag_type
,
tag_key
,
leading_whitespace
,
...
...
@@ -159,7 +158,7 @@ class Parser(object):
parse_tree
.
append
(
node
)
# Save the rest of the template.
parse_tree
.
append
(
template
[
index
:])
parse_tree
.
append
(
template
[
start_
index
:])
return
ParsedTemplate
(
parse_tree
)
...
...
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