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
Hide 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:
...
@@ -379,8 +379,9 @@ class TALGenerator:
replace = taldict.get("
replace
")
replace = taldict.get("
replace
")
attrsubst = taldict.get("
attributes
")
attrsubst = taldict.get("
attributes
")
onError = taldict.get("
on
-
error
")
onError = taldict.get("
on
-
error
")
if len(metaldict) > 1:
if len(metaldict) > 1 and (defineMacro or useMacro):
raise METALError("
at
most
one
METAL
attribute
per
element
",
raise METALError("
define
-
macro
and
use
-
macro
cannot
be
used
"
"
together
or
with
define
-
slot
or
fill
-
slot
",
position)
position)
if content and replace:
if content and replace:
raise TALError("
content
and
replace
are
mutually
exclusive
",
raise TALError("
content
and
replace
are
mutually
exclusive
",
...
@@ -402,12 +403,12 @@ class TALGenerator:
...
@@ -402,12 +403,12 @@ class TALGenerator:
self.pushSlots()
self.pushSlots()
self.pushProgram()
self.pushProgram()
todo["
useMacro
"] = useMacro
todo["
useMacro
"] = useMacro
if defineSlot:
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if fillSlot:
if fillSlot:
self.pushProgram()
self.pushProgram()
todo["
fillSlot
"] = fillSlot
todo["
fillSlot
"] = fillSlot
if defineSlot:
self.pushProgram()
todo["
defineSlot
"] = defineSlot
if taldict:
if taldict:
self.emit("
beginScope
")
self.emit("
beginScope
")
self.emit("
rawAttrs
", self.makeAttrDict(attrlist))
self.emit("
rawAttrs
", self.makeAttrDict(attrlist))
...
@@ -504,14 +505,14 @@ class TALGenerator:
...
@@ -504,14 +505,14 @@ class TALGenerator:
self.emitOnError(name, onError, position)
self.emitOnError(name, onError, position)
if scope:
if scope:
self.emit("
endScope
")
self.emit("
endScope
")
if defineMacro:
self.emitDefineMacro(defineMacro, position)
if useMacro:
self.emitUseMacro(useMacro)
if defineSlot:
if defineSlot:
self.emitDefineSlot(defineSlot)
self.emitDefineSlot(defineSlot)
if fillSlot:
if fillSlot:
self.emitFillSlot(fillSlot, position)
self.emitFillSlot(fillSlot, position)
if useMacro:
self.emitUseMacro(useMacro)
if defineMacro:
self.emitDefineMacro(defineMacro, position)
def test():
def test():
t = TALGenerator()
t = TALGenerator()
...
...
lib/python/TAL/tests/input/test15.html
View file @
a852620a
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
<div
metal:define-macro=
"OUTER"
>
<div
metal:define-macro=
"OUTER"
>
<div
metal:use-macro=
"INNER"
>
<div
metal:use-macro=
"INNER"
>
<xxx
metal:fill-slot=
"INNERSLOT"
>
<xxx
metal:
define-slot=
"OUTERSLOT"
metal:
fill-slot=
"INNERSLOT"
>
<xxx
metal:define-slot=
"OUTERSLOT"
>
OUTERSLOT
</xxx>
OUTERSLOT
</xxx>
</xxx>
</div>
</div>
</div>
</div>
...
...
lib/python/TAL/tests/output/test15.html
View file @
a852620a
...
@@ -9,23 +9,21 @@
...
@@ -9,23 +9,21 @@
<div>
<div>
<span>
<span>
<xxx>
<xxx>
<xxx>
OUTERSLOT
</xxx>
OUTERSLOT
</xxx>
</xxx>
</span>
</span>
</div>
</div>
<div>
<div>
<span>
<span>
<xxx>
<div>
outer-argument
</div>
<div>
outer-argument
</div>
</xxx>
</span>
</span>
</div>
</div>
<div>
<div>
<span>
<span>
<xxx>
<xxx>
<xxx>
OUTERSLOT
</xxx>
OUTERSLOT
</xxx>
</xxx>
</span>
</span>
</div>
</div>
lib/python/TAL/tests/test_htmltalparser.py
View file @
a852620a
...
@@ -468,8 +468,6 @@ class TALGeneratorTestCases(TestCaseBase):
...
@@ -468,8 +468,6 @@ class TALGeneratorTestCases(TestCaseBase):
self
.
_should_error
(
"<html metal:use-macro='x'>"
+
self
.
_should_error
(
"<html metal:use-macro='x'>"
+
2
*
"<p metal:fill-slot='y' />"
+
"</html>"
,
exc
)
2
*
"<p metal:fill-slot='y' />"
+
"</html>"
,
exc
)
self
.
_should_error
(
"<p metal:foobar='x' />"
,
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
)
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