Cope better with attributes at toplevel.

This commit is contained in:
Eric S. Raymond 2009-09-20 16:22:18 +00:00
parent ae20489ec0
commit 6a60c523a3

View File

@ -146,11 +146,7 @@ msgstr ""
if isAttribute(nav): if isAttribute(nav):
if verbose > 1: if verbose > 1:
print "Attribute", nav, "with ancestors", nav.ancestors() print "Attribute", nav, "with ancestors", nav.ancestors()
try: attributes_stack[-1].append(nav.text.strip())
attributes_stack[-1].append(nav.text.strip())
except IndexError:
print >>sys.stderr, "wmlxgettext: Attributes without an enclosing tag."
sys.exit(1)
get_translatables(nav, fn) get_translatables(nav, fn)
elif isCloser(nav): elif isCloser(nav):
if verbose > 1: if verbose > 1:
@ -203,8 +199,12 @@ msgstr ""
if verbose: if verbose:
print "wmlxgettext: skipping %s, wrong domain" % fn print "wmlxgettext: skipping %s, wrong domain" % fn
continue continue
opener_stack.append(("<toplevel>", fn, 0))
attributes_stack.append([])
for nav in WmllintIterator(lines, fn): for nav in WmllintIterator(lines, fn):
handle_element(nav, fn) handle_element(nav, fn)
opener_stack.pop()
# Debugging output # Debugging output
if verbose: if verbose:
print "Translatables:" print "Translatables:"