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
73306a88
Commit
73306a88
authored
Jan 13, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added "tag_type = matches['tag']" to _handle_match().
parent
b808970c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
pystache/renderengine.py
+12
-10
No files found.
pystache/renderengine.py
View file @
73306a88
...
...
@@ -349,11 +349,13 @@ class RenderEngine(object):
elif
matches
[
'raw'
]
is
not
None
:
matches
.
update
(
tag
=
'{'
,
name
=
matches
[
'raw_name'
])
tag_type
=
matches
[
'tag'
]
# Standalone (non-interpolation) tags consume the entire line,
# both leading whitespace and trailing newline.
did_tag_begin_line
=
match_index
==
0
or
template
[
match_index
-
1
]
in
END_OF_LINE_CHARACTERS
did_tag_end_line
=
end_index
==
len
(
template
)
or
template
[
end_index
]
in
END_OF_LINE_CHARACTERS
is_tag_interpolating
=
matches
[
'tag'
]
in
[
''
,
'&'
,
'{'
]
is_tag_interpolating
=
tag_type
in
[
''
,
'&'
,
'{'
]
if
did_tag_begin_line
and
did_tag_end_line
and
not
is_tag_interpolating
:
if
end_index
<
len
(
template
):
...
...
@@ -367,17 +369,17 @@ class RenderEngine(object):
name
=
matches
[
'name'
]
if
matches
[
'tag'
]
==
'!'
:
if
tag_type
==
'!'
:
return
end_index
if
matches
[
'tag'
]
==
'='
:
if
tag_type
==
'='
:
delimiters
=
name
.
split
()
self
.
_change_delimiters
(
delimiters
)
return
end_index
if
matches
[
'tag'
]
==
'>'
:
if
tag_type
==
'>'
:
func
=
self
.
_make_get_partial
(
name
,
matches
[
'whitespace'
])
elif
matches
[
'tag'
]
in
[
'#'
,
'^'
]:
elif
tag_type
in
[
'#'
,
'^'
]:
try
:
self
.
parse_to_tree
(
template
=
template
,
index
=
end_index
)
...
...
@@ -386,26 +388,26 @@ class RenderEngine(object):
tmpl
=
e
.
template
end_index
=
e
.
position
if
matches
[
'tag'
]
==
'#'
:
if
tag_type
==
'#'
:
func
=
self
.
_make_get_section
(
name
,
bufr
,
tmpl
,
self
.
_delimiters
)
else
:
func
=
_make_get_inverse
(
name
,
bufr
)
elif
matches
[
'tag'
]
in
[
'{'
,
'&'
]:
elif
tag_type
in
[
'{'
,
'&'
]:
func
=
self
.
_make_get_literal
(
name
)
elif
matches
[
'tag'
]
==
''
:
elif
tag_type
==
''
:
func
=
self
.
_make_get_escaped
(
name
)
elif
matches
[
'tag'
]
==
'/'
:
elif
tag_type
==
'/'
:
# TODO: don't use exceptions for flow control.
raise
EndOfSection
(
parse_tree
,
template
[
start_index
:
match_index
],
end_index
)
else
:
raise
Exception
(
"
'
%
s' is an unrecognized type!"
%
matches
[
'tag'
]
)
raise
Exception
(
"
Unrecognized tag type:
%
s"
%
repr
(
tag_type
)
)
parse_tree
.
append
(
func
)
...
...
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