Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-mako
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-mako
Commits
a8bb52a9
Commit
a8bb52a9
authored
18 years ago
by
Mike Bayer
Browse files
Options
Downloads
Patches
Plain Diff
- further escaping added for multibyte expressions in %def, %call attributes
[ticket:24]
parent
2e9289c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGES
+2
-0
2 additions, 0 deletions
CHANGES
lib/mako/lexer.py
+1
-1
1 addition, 1 deletion
lib/mako/lexer.py
test/template.py
+17
-0
17 additions, 0 deletions
test/template.py
with
20 additions
and
1 deletion
CHANGES
+
2
−
0
View file @
a8bb52a9
...
...
@@ -9,6 +9,8 @@ propigates __nonzero__ method so it evaulates to False if not present,
True otherwise. this way you can say % if caller:\n ${caller.body()}\n% endif
- <%include> has an "args" attribute that can pass arguments to the called
template (keyword arguments only, must be declared in that page's <%page> tag.)
- further escaping added for multibyte expressions in %def, %call attributes
[ticket:24]
0.1.3
- ***Small Syntax Change*** - the single line comment character is now
...
...
This diff is collapsed.
Click to expand it.
lib/mako/lexer.py
+
1
−
1
View file @
a8bb52a9
...
...
@@ -191,7 +191,7 @@ class Lexer(object):
if
attr
:
for
att
in
re
.
findall
(
r
"
\s*(\w+)\s*=\s*(?:
'
([^
'
]*)
'
|\"([^\"]*)\")
"
,
attr
):
(
key
,
val1
,
val2
)
=
att
attributes
[
key
]
=
val1
or
val2
attributes
[
key
]
=
self
.
escape_code
(
val1
or
val2
)
self
.
append_node
(
parsetree
.
Tag
,
keyword
,
attributes
)
if
isend
:
self
.
tag
.
pop
()
...
...
This diff is collapsed.
Click to expand it.
test/template.py
+
17
−
0
View file @
a8bb52a9
...
...
@@ -79,6 +79,23 @@ class EncodingTest(unittest.TestCase):
"""
.
encode
(
'
utf-8
'
))
assert
template
.
render_unicode
().
strip
()
==
u
"""
hi, drôle de petit voix m’a réveillé.
"""
def
test_unicode_literal_in_def
(
self
):
template
=
Template
(
u
"""
## -*- coding: utf-8 -*-
<%def name=
"
bello(foo, bar)
"
>
Foo: ${ foo }
Bar: ${ bar }
</%def>
<%call expr=
"
bello(foo=u
'
árvíztűrő tükörfúrógép
'
, bar=u
'
ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
'
)
"
>
</%call>
"""
.
encode
(
'
utf-8
'
))
assert
flatten_result
(
template
.
render_unicode
())
==
u
"""
Foo: árvíztűrő tükörfúrógép Bar: ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
"""
template
=
Template
(
u
"""
## -*- coding: utf-8 -*-
<%def name=
"
hello(foo=u
'
árvíztűrő tükörfúrógép
'
, bar=u
'
ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
'
)
"
>
Foo: ${ foo }
Bar: ${ bar }
</%def>
${ hello() }
"""
.
encode
(
'
utf-8
'
))
assert
flatten_result
(
template
.
render_unicode
())
==
u
"""
Foo: árvíztűrő tükörfúrógép Bar: ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
"""
def
test_input_encoding
(
self
):
"""
test the
'
input_encoding
'
flag on Template, and that unicode objects arent double-decoded
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment