Przeglądaj źródła

added check for None node

pull/15/head
notconfusing 11 lat temu
rodzic
commit
efc230e7e9
1 zmienionych plików z 3 dodań i 2 usunięć
  1. +3
    -2
      mwparserfromhell/wikicode.py

+ 3
- 2
mwparserfromhell/wikicode.py Wyświetl plik

@@ -56,8 +56,9 @@ class Wikicode(StringMixIn):
This is implemented by the ``__iternodes__()`` generator of ``Node``
classes, which by default yields itself and nothing more.
"""
for context, child in node.__iternodes__(self._get_all_nodes):
yield child
if node: #fixes bug on malformed wikitext from wikipedia dump
for context, child in node.__iternodes__(self._get_all_nodes):
yield child

def _get_context(self, node, obj):
"""Return a ``Wikicode`` that contains *obj* in its descendants.


Ładowanie…
Anuluj
Zapisz