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
8025298f
Commit
8025298f
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed partials to indent before rendering.
parent
18d62861
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
pystache/renderengine.py
+3
-5
tests/spec_cases.py
+5
-1
No files found.
pystache/renderengine.py
View file @
8025298f
...
...
@@ -399,10 +399,6 @@ class Template(object):
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
):
"""
Get a value from the given context as a basestring instance.
...
...
@@ -454,7 +450,9 @@ 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
.
_render_partial
(
name
,
context
))
template
=
self
.
get_partial
(
name
)
# Indent before rendering.
template
=
re
.
sub
(
nonblank
,
indentation
+
r'\1'
,
template
)
return
self
.
render_template
(
template
,
context
)
return
func
...
...
tests/spec_cases.py
View file @
8025298f
...
...
@@ -55,7 +55,11 @@ def buildTest(testData, spec_filename):
Template:
\"
""
%
s
\"
""
Expected:
%
s
Actual:
%
s"""
%
(
description
,
template
,
repr
(
expected
),
repr
(
actual
))
Actual:
%
s
Expected:
\"
""
%
s
\"
""
Actual:
\"
""
%
s
\"
""
"""
%
(
description
,
template
,
repr
(
expected
),
repr
(
actual
),
expected
,
actual
)
self
.
assertEquals
(
actual
,
expected
,
message
)
...
...
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