Browse Source

Fix tokenizer so we don't destroy our textbuf writing an empty stack

* Also fix a bug in Argument
tags/v0.1
Ben Kurtovic 12 years ago
parent
commit
353122105d
2 changed files with 3 additions and 2 deletions
  1. +1
    -1
      mwparserfromhell/nodes/argument.py
  2. +2
    -1
      mwparserfromhell/parser/tokenizer.py

+ 1
- 1
mwparserfromhell/nodes/argument.py View File

@@ -33,7 +33,7 @@ class Argument(Node):
def __init__(self, name, default=None): def __init__(self, name, default=None):
super(Argument, self).__init__() super(Argument, self).__init__()
self._name = name self._name = name
self._default = None
self._default = default


def __unicode__(self): def __unicode__(self):
start = "{{{" + str(self.name) start = "{{{" + str(self.name)


+ 2
- 1
mwparserfromhell/parser/tokenizer.py View File

@@ -122,7 +122,8 @@ class Tokenizer(object):
"""Pop the current stack, write *text*, and then write the stack.""" """Pop the current stack, write *text*, and then write the stack."""
stack = self._pop() stack = self._pop()
self._write_text(text) self._write_text(text)
self._write_all(stack)
if stack:
self._write_all(stack)
self._head -= 1 self._head -= 1


def _read(self, delta=0, wrap=False, strict=False): def _read(self, delta=0, wrap=False, strict=False):


Loading…
Cancel
Save