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
bb549161
Commit
bb549161
authored
Jan 11, 2011
by
Carl Whittaker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding tests for negated (empty list) tag, partials in loops not referencing parent values.
parent
6c2d2b05
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
6 deletions
+21
-6
examples/inverted.mustache
+2
-2
examples/inverted.py
+7
-0
examples/nested_context.mustache
+2
-1
examples/template_partial.mustache
+5
-2
examples/template_partial.py
+4
-0
tests/test_view.py
+1
-1
No files found.
examples/inverted.mustache
View file @
bb549161
{{^
f
}}
one
{{/
f
}}
,
{{
two
}}
,
{{^
f
}}
three
{{/
f
}}{{^
t
}}
, four!
{{/
t
}}
\ No newline at end of file
{{^
f
}}
one
{{/
f
}}
,
{{
two
}}
,
{{^
f
}}
three
{{/
f
}}{{^
t
}}
, four!
{{/
t
}}{{^
empty_list
}}
, empty list
{{/
empty_list
}}{{^
populated_list
}}
, shouldn't see me
{{/
populated_list
}}
\ No newline at end of file
examples/inverted.py
View file @
bb549161
...
...
@@ -11,3 +11,9 @@ class Inverted(pystache.View):
def
two
(
self
):
return
'two'
def
empty_list
(
self
):
return
[]
def
populated_list
(
self
):
return
[
'some_value'
]
\ No newline at end of file
examples/nested_context.mustache
View file @
bb549161
{{#
foo
}}{{
thing1
}}
and
{{
thing2
}}
and
{{
outer_thing
}}{{/
foo
}}{{^
foo
}}
Not foo!
{{/
foo
}}
{{#
foo
}}{{
thing1
}}
and
{{
thing2
}}
and
{{
outer_thing
}}{{/
foo
}}{{^
foo
}}
Not foo!
{{/
foo
}}
\ No newline at end of file
examples/template_partial.mustache
View file @
bb549161
<h1>
{{
title
}}
</h1>
{{>
inner_partial
}}
\ No newline at end of file
{{>
inner_partial
}}
{{#
looping
}}
{{>
inner_partial
}}
{{/
looping
}}
\ No newline at end of file
examples/template_partial.py
View file @
bb549161
...
...
@@ -8,3 +8,6 @@ class TemplatePartial(pystache.View):
def
title_bars
(
self
):
return
'-'
*
len
(
self
.
title
())
def
looping
(
self
):
return
[{
'item'
:
'one'
},
{
'item'
:
'two'
},
{
'item'
:
'three'
}]
\ No newline at end of file
tests/test_view.py
View file @
bb549161
...
...
@@ -88,7 +88,7 @@ class TestView(unittest.TestCase):
def
test_inverted
(
self
):
view
=
Inverted
()
self
.
assertEquals
(
view
.
render
(),
"""one, two, three"""
)
self
.
assertEquals
(
view
.
render
(),
"""one, two, three
, empty list
"""
)
if
__name__
==
'__main__'
:
...
...
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