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
9c2048a1
Commit
9c2048a1
authored
Jan 02, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed call() function.
parent
c1a96ac3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
36 deletions
+23
-36
pystache/renderengine.py
+23
-36
No files found.
pystache/renderengine.py
View file @
9c2048a1
...
...
@@ -17,47 +17,34 @@ DEFAULT_TAG_CLOSING = '}}'
END_OF_LINE_CHARACTERS
=
[
'
\r
'
,
'
\n
'
]
def
call
(
val
,
context
):
"""
Returns: a string of type unicode.
Arguments:
val: the argument val can be any of the following:
* a unicode string
* the return value of a call to any of the following:
* RenderEngine._make_get_literal():
Args: context
Returns: unicode
* RenderEngine._make_get_escaped():
Args: context
Returns: unicode
* RenderEngine._make_get_partial()
Args: context
Returns: unicode
* RenderEngine._make_get_section()
Args: context
Returns: unicode
* _make_get_inverse()
Args: context
Returns: unicode
"""
if
callable
(
val
):
val
=
val
(
context
)
return
val
def
render_parse_tree
(
parse_tree
,
context
):
"""
Returns: a string of type unicode.
The elements of parse_tree can be any of the following:
* a unicode string
* the return value of a call to any of the following:
* RenderEngine._make_get_literal():
Args: context
Returns: unicode
* RenderEngine._make_get_escaped():
Args: context
Returns: unicode
* RenderEngine._make_get_partial()
Args: context
Returns: unicode
* RenderEngine._make_get_section()
Args: context
Returns: unicode
* _make_get_inverse()
Args: context
Returns: unicode
"""
get_
string
=
lambda
val
:
call
(
val
,
context
)
parts
=
map
(
get_
string
,
parse_tree
)
get_
unicode
=
lambda
val
:
val
(
context
)
if
callable
(
val
)
else
val
parts
=
map
(
get_
unicode
,
parse_tree
)
s
=
''
.
join
(
parts
)
return
unicode
(
s
)
...
...
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