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
06d0b3e1
Commit
06d0b3e1
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got partials working.
parent
e29f92b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
pystache/renderengine.py
+9
-6
No files found.
pystache/renderengine.py
View file @
06d0b3e1
...
...
@@ -120,7 +120,7 @@ class RenderEngine(object):
_template
.
to_unicode
=
self
.
literal
_template
.
escape
=
self
.
escape
_template
.
partial
=
self
.
load_partial
_template
.
get_
partial
=
self
.
load_partial
return
_template
.
render_template
(
template
=
template
,
context
=
context
)
...
...
@@ -386,8 +386,12 @@ class Template(object):
def
escape
(
self
,
text
):
return
cgi
.
escape
(
text
,
True
)
def
partial
(
self
,
name
,
context
=
None
):
return
context
.
partial
(
name
)
def
get_partial
(
self
,
name
):
pass
def
_render_partial
(
self
,
name
,
context
):
template
=
self
.
get_partial
(
name
)
return
self
.
render_template
(
template
,
context
)
def
_get_string_value
(
self
,
context
,
tag_name
):
"""
...
...
@@ -421,7 +425,6 @@ class Template(object):
return
val
def
escape_tag_function
(
self
,
name
):
get_literal
=
self
.
literal_tag_function
(
name
)
def
func
(
context
):
...
...
@@ -441,7 +444,7 @@ class Template(object):
def
partial_tag_function
(
self
,
name
,
indentation
=
''
):
def
func
(
context
):
nonblank
=
re
.
compile
(
r'^(.)'
,
re
.
M
)
template
=
re
.
sub
(
nonblank
,
indentation
+
r'\1'
,
self
.
partial
(
name
,
context
))
template
=
re
.
sub
(
nonblank
,
indentation
+
r'\1'
,
self
.
_render_
partial
(
name
,
context
))
return
self
.
render_template
(
template
,
context
)
return
func
...
...
@@ -476,7 +479,7 @@ class Template(object):
template
.
ctag
=
delims
[
1
]
template
.
escape
=
self
.
escape
template
.
partial
=
self
.
partial
template
.
get_partial
=
self
.
get_
partial
template
.
to_unicode
=
self
.
to_unicode
template
.
_compile_regexps
()
...
...
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