Parcourir la source

Push the textbuffer to fix a couple broken tests.

tags/v0.3
Ben Kurtovic il y a 11 ans
Parent
révision
9ea06c2830
2 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. +1
    -0
      mwparserfromhell/parser/tokenizer.py
  2. +7
    -0
      tests/tokenizer/tags.mwtest

+ 1
- 0
mwparserfromhell/parser/tokenizer.py Voir le fichier

@@ -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 Voir le fichier

@@ -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="")]

Chargement…
Annuler
Enregistrer