tatuylonen / wikitextprocessor

Python package for WikiMedia dump processing (Wiktionary, Wikipedia etc). Wikitext parsing, template expansion, Lua module execution. For data extraction, bulk syntax checking, error detection, and offline formatting.
Other
90 stars 23 forks source link

Fix misuse of `Match.start()` causes template expanded as text bug #250

Closed xxyzz closed 4 months ago

xxyzz commented 4 months ago

m.start(1) returns the location in the text passed to re.sub() not the location in the matched group text.

Fix https://github.com/tatuylonen/wiktextract/issues/533

xxyzz commented 4 months ago

If I use args[0].strip() == "" at https://github.com/tatuylonen/wikitextprocessor/blob/f2fbe0495f975c5b28b16aa1a8ba8640217efaa9/src/wikitextprocessor/core.py#L669, then test test_left_curly_bracket_in_template2 will fail. I'll ignore this for now...

kristian-clausal commented 4 months ago

Hopefully 'llave' won't break again. Thanks for looking at this.