Kaynağa Gözat

Fix an edge case when we recurse too deeply.

tags/v0.3
Ben Kurtovic 11 yıl önce
ebeveyn
işleme
6784ff73bf
2 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. +2
    -1
      mwparserfromhell/parser/tokenizer.c
  2. +4
    -2
      mwparserfromhell/parser/tokenizer.py

+ 2
- 1
mwparserfromhell/parser/tokenizer.c Dosyayı Görüntüle

@@ -2272,7 +2272,8 @@ static PyObject* Tokenizer_parse_style(Tokenizer* self)
return NULL;
return Tokenizer_pop(self);
}
self->topstack->context |= LC_STYLE_PASS_AGAIN;
if (context & LC_STYLE_ITALICS)
self->topstack->context |= LC_STYLE_PASS_AGAIN;
}
for (i = 0; i < ticks; i++) {
if (Tokenizer_emit_char(self, *"'"))


+ 4
- 2
mwparserfromhell/parser/tokenizer.py Dosyayı Görüntüle

@@ -823,7 +823,8 @@ class Tokenizer(object):
except BadRoute as route:
self._head = reset
if route.context & contexts.STYLE_PASS_AGAIN:
stack = self._parse(route.context | contexts.STYLE_SECOND_PASS)
new_ctx = contexts.STYLE_ITALICS | contexts.STYLE_SECOND_PASS
stack = self._parse(new_ctx)
else:
return self._emit_text("''")
self._emit_style_tag("i", "''", stack)
@@ -912,7 +913,8 @@ class Tokenizer(object):
if self._context & contexts.STYLE_SECOND_PASS:
self._emit_text("'")
return self._pop()
self._context |= contexts.STYLE_PASS_AGAIN
if self._context & contexts.STYLE_ITALICS:
self._context |= contexts.STYLE_PASS_AGAIN
self._emit_text("'" * ticks)
elif ticks == 2:
self._parse_italics()


Yükleniyor…
İptal
Kaydet