5j9 / wikitextparser

A Python library to parse MediaWiki WikiText
GNU General Public License v3.0
289 stars 22 forks source link

Empty tag + closing tag confuses tags-parsing #108

Closed TrueBrain closed 2 years ago

TrueBrain commented 2 years ago

Given the following example:

import wikitextparser
wikitextparser.parse("<ref/ ></ref>").get_tags()[0].name

Raises an exception TypeError: 'NoneType' object is not subscriptable at https://github.com/5j9/wikitextparser/blob/f64e098b0ba040595f6fc427edf6409308761bd0/wikitextparser/_tag.py#L148. Removing the space does not create the exception.