Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a852620a
Commit
a852620a
authored
May 18, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow define-slot and fill-slot on the same tag.
parent
30ebde7b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
18 deletions
+15
-18
lib/python/TAL/TALGenerator.py
lib/python/TAL/TALGenerator.py
+10
-9
lib/python/TAL/tests/input/test15.html
lib/python/TAL/tests/input/test15.html
+2
-2
lib/python/TAL/tests/output/test15.html
lib/python/TAL/tests/output/test15.html
+3
-5
lib/python/TAL/tests/test_htmltalparser.py
lib/python/TAL/tests/test_htmltalparser.py
+0
-2
No files found.
lib/python/TAL/TALGenerator.py
View file @
a852620a
...
...
@@ -379,8 +379,9 @@ class TALGenerator:
replace = taldict.get("
replace
")
attrsubst = taldict.get("
attributes
")
onError = taldict.get("
on
-
error
")
if len(metaldict) > 1:
raise METALError("
at
most
one
METAL
attribute
per
element
",
if len(metaldict) > 1 and (defineMacro or useMacro):
raise METALError("
define
-
macro
and
use
-
macro
cannot
be
used
"
"
together
or
with
define
-
slot
or
fill
-
slot
",
position)
if content and replace:
raise TALError("
content
and
replace
are
mutually
exclusive
",
...
...
@@ -402,12 +403,12 @@ class TALGenerator:
self.pushSlots()
self.pushProgram()
todo["
useMacro
"] = useMacro
if defineSlot:
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if fillSlot:
self.pushProgram()
todo["
fillSlot
"] = fillSlot
if defineSlot:
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if taldict:
self.emit("
beginScope
")
self.emit("
rawAttrs
", self.makeAttrDict(attrlist))
...
...
@@ -504,14 +505,14 @@ class TALGenerator:
self.emitOnError(name, onError, position)
if scope:
self.emit("
endScope
")
if defineMacro:
self.emitDefineMacro(defineMacro, position)
if useMacro:
self.emitUseMacro(useMacro)
if defineSlot:
self.emitDefineSlot(defineSlot)
if fillSlot:
self.emitFillSlot(fillSlot, position)
if useMacro:
self.emitUseMacro(useMacro)
if defineMacro:
self.emitDefineMacro(defineMacro, position)
def test():
t = TALGenerator()
...
...
lib/python/TAL/tests/input/test15.html
View file @
a852620a
...
...
@@ -8,8 +8,8 @@
<div
metal:define-macro=
"OUTER"
>
<div
metal:use-macro=
"INNER"
>
<xxx
metal:fill-slot=
"INNERSLOT"
>
<xxx
metal:define-slot=
"OUTERSLOT"
>
OUTERSLOT
</xxx>
<xxx
metal:
define-slot=
"OUTERSLOT"
metal:
fill-slot=
"INNERSLOT"
>
OUTERSLOT
</xxx>
</div>
</div>
...
...
lib/python/TAL/tests/output/test15.html
View file @
a852620a
...
...
@@ -9,23 +9,21 @@
<div>
<span>
<xxx>
<xxx>
OUTERSLOT
</xxx>
OUTERSLOT
</xxx>
</span>
</div>
<div>
<span>
<xxx>
<div>
outer-argument
</div>
</xxx>
</span>
</div>
<div>
<span>
<xxx>
<xxx>
OUTERSLOT
</xxx>
OUTERSLOT
</xxx>
</span>
</div>
lib/python/TAL/tests/test_htmltalparser.py
View file @
a852620a
...
...
@@ -468,8 +468,6 @@ class TALGeneratorTestCases(TestCaseBase):
self
.
_should_error
(
"<html metal:use-macro='x'>"
+
2
*
"<p metal:fill-slot='y' />"
+
"</html>"
,
exc
)
self
.
_should_error
(
"<p metal:foobar='x' />"
,
exc
)
self
.
_should_error
(
"<p metal:define-slot='x' metal:fill-slot='x' />"
,
exc
)
self
.
_should_error
(
"<p metal:define-macro='x'>"
,
exc
)
...
...
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