peter17 / mediawiki-parser

An experimental Python parser for MediaWiki syntax with a focus on extensibility and comprehensibility
GNU General Public License v3.0
59 stars 18 forks source link

Preprocessor fails to parse an empty string #3

Open svetlin-mladenov opened 7 years ago

svetlin-mladenov commented 7 years ago

Here is my testing code:

templates = {}
from mediawiki_parser.preprocessor import make_parser
preprocessor = make_parser(templates)
output = preprocessor.parse('')

The expected behavior is for the code to run without exceptions because an empty string is a valid media wiki page.

Instead the preprocessor.parse('') call fails with:

Match failure for pattern
   wikitext:(not_styled_text / styled_text / allowed_text / EOL)+
in source text at location
   index #0   line 1   character 1

   ^
Cannot match at least 1 time(s) pattern <?>:not_styled_text / styled_text / allowed_text / EOL.
(wrapped pattern error below)

... (and lots more)

The test fails even against the latest commit from master ( d7fa6ffeb7daf1e5368feefcdd6fc4d37c18ab98 )