Преглед на файлове

Move repeated context checks into one block in Tokenizer._parse().

tags/v0.3
Ben Kurtovic преди 12 години
родител
ревизия
252cc13a99
променени са 1 файла, в които са добавени 12 реда и са изтрити 14 реда
  1. +12
    -14
      mwparserfromhell/parser/tokenizer.py

+ 12
- 14
mwparserfromhell/parser/tokenizer.py Целия файл

@@ -574,20 +574,18 @@ class Tokenizer(object):
# self._handle_attribute_name() # self._handle_attribute_name()
# elif this == '"' and self._context & contexts.TAG_ATTR_BODY_QUOTED: # elif this == '"' and self._context & contexts.TAG_ATTR_BODY_QUOTED:
# self._handle_quoted_attribute_close() # self._handle_quoted_attribute_close()
elif this == "\n" and (
self._context & contexts.TAG_OPEN and not
self._context & contexts.TAG_ATTR_BODY_QUOTED):
if self._context & contexts.TAG_CLOSE:
self._pop()
self._fail_route()
elif this == ">" and (
self._context & contexts.TAG_OPEN and not
self._context & contexts.TAG_ATTR_BODY_QUOTED):
self._handle_tag_close_open()
elif this == "/" and next == ">" and (
self._context & contexts.TAG_OPEN and not
self._context & contexts.TAG_ATTR_BODY_QUOTED):
return self._handle_tag_selfclose()
elif self._context & contexts.TAG_OPEN and (
not self._context & contexts.TAG_ATTR_BODY_QUOTED):
if this == "\n":
if self._context & contexts.TAG_CLOSE:
self._pop()
self._fail_route()
elif this == ">":
self._handle_tag_close_open()
elif this == "/":
return self._handle_tag_selfclose()
else:
self._write_text(this)
elif this == "<" and next == "/" and ( elif this == "<" and next == "/" and (
self._context & contexts.TAG_BODY): self._context & contexts.TAG_BODY):
self._handle_tag_open_close() self._handle_tag_open_close()


Зареждане…
Отказ
Запис