Browse Source

Push the textbuffer to fix a couple broken tests.

tags/v0.3
Ben Kurtovic 11 years ago
parent
commit
9ea06c2830
2 changed files with 8 additions and 0 deletions
  1. +1
    -0
      mwparserfromhell/parser/tokenizer.py
  2. +7
    -0
      tests/tokenizer/tags.mwtest

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

@@ -452,6 +452,7 @@ class Tokenizer(object):
self._context ^= contexts.TAG_OPEN_NAME
self._context |= contexts.TAG_BODY

self._push_textbuffer()
if isinstance(self._stack[-1], tokens.TagAttrStart):
return self._stack.pop().padding
return ""


+ 7
- 0
tests/tokenizer/tags.mwtest View File

@@ -86,3 +86,10 @@ name: attribute_selfclosing_value
label: a self-closing tag with a single attribute with a value
input: "<ref name=foo/>"
output: [TagOpenOpen(showtag=True, type=101), Text(text="ref"), TagAttrStart(padding=""), Text(text="name"), TagAttrEquals(), Text(text="foo"), TagCloseSelfclose(padding="")]

---

name: attribute_selfclosing_value_quoted
label: a self-closing tag with a single quoted attribute
input: "<ref name="foo"/>"
output: [TagOpenOpen(showtag=True, type=101), Text(text="ref"), TagAttrStart(padding=""), Text(text="name"), TagAttrEquals(), TagAttrQuote(), Text(text="foo"), TagCloseSelfclose(padding="")]

Loading…
Cancel
Save