Commit 445409d5 authored by Godefroid Chapelle's avatar Godefroid Chapelle

merge from gotcha-talz3_backport-branch

parent 860436c3
...@@ -180,18 +180,7 @@ class TALInterpreter: ...@@ -180,18 +180,7 @@ class TALInterpreter:
self.macroStack.append([macroName, slots, entering, self.i18nContext]) self.macroStack.append([macroName, slots, entering, self.i18nContext])
def popMacro(self): def popMacro(self):
stuff = self.macroStack.pop() return self.macroStack.pop()
self.i18nContext = stuff[3]
return stuff
def macroContext(self, what):
macroStack = self.macroStack
i = len(macroStack)
while i > 0:
i = i-1
if macroStack[i][0] == what:
return i
return -1
def __call__(self): def __call__(self):
assert self.level == 0 assert self.level == 0
...@@ -291,6 +280,12 @@ class TALInterpreter: ...@@ -291,6 +280,12 @@ class TALInterpreter:
for item in attrList: for item in attrList:
if _len(item) == 2: if _len(item) == 2:
name, s = item name, s = item
else:
# item[2] is the 'action' field:
if item[2] in ('metal', 'tal', 'xmlns', 'i18n'):
if not self.showtal:
continue
ok, name, s = self.attrAction(item)
else: else:
ok, name, s = attrAction(self, item) ok, name, s = attrAction(self, item)
if not ok: if not ok:
...@@ -299,7 +294,8 @@ class TALInterpreter: ...@@ -299,7 +294,8 @@ class TALInterpreter:
if (wrap and if (wrap and
col >= align and col >= align and
col + 1 + slen > wrap): col + 1 + slen > wrap):
append("\n" + " "*align) append("\n")
append(" "*align)
col = align + slen col = align + slen
else: else:
append(" ") append(" ")
...@@ -314,8 +310,7 @@ class TALInterpreter: ...@@ -314,8 +310,7 @@ class TALInterpreter:
def attrAction(self, item): def attrAction(self, item):
name, value, action = item[:3] name, value, action = item[:3]
if action == 'insert' or (action in ('metal', 'tal', 'xmlns', 'i18n') if action == 'insert':
and not self.showtal):
return 0, name, value return 0, name, value
macs = self.macroStack macs = self.macroStack
if action == 'metal' and self.metal and macs: if action == 'metal' and self.metal and macs:
...@@ -345,8 +340,6 @@ class TALInterpreter: ...@@ -345,8 +340,6 @@ class TALInterpreter:
return 1, name, value return 1, name, value
def attrAction_tal(self, item): def attrAction_tal(self, item):
if item[2] in ('metal', 'tal', 'xmlns', 'i18n'):
return self.attrAction(item)
name, value, action = item[:3] name, value, action = item[:3]
ok = 1 ok = 1
expr, xlat, msgid = item[3:] expr, xlat, msgid = item[3:]
...@@ -409,14 +402,6 @@ class TALInterpreter: ...@@ -409,14 +402,6 @@ class TALInterpreter:
self.do_optTag(stuff) self.do_optTag(stuff)
bytecode_handlers["optTag"] = do_optTag bytecode_handlers["optTag"] = do_optTag
def dumpMacroStack(self, prefix, suffix, value):
sys.stderr.write("+---- %s%s = %s\n" % (prefix, suffix, value))
for i in range(len(self.macroStack)):
what, macroName, slots = self.macroStack[i][:3]
sys.stderr.write("| %2d. %-12s %-12s %s\n" %
(i, what, macroName, slots and slots.keys()))
sys.stderr.write("+--------------------------------------\n")
def do_rawtextBeginScope(self, (s, col, position, closeprev, dict)): def do_rawtextBeginScope(self, (s, col, position, closeprev, dict)):
self._stream_write(s) self._stream_write(s)
self.col = col self.col = col
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment