sweble / sweble-wikitext

The Sweble Wikitext Components module provides a parser for MediaWiki's wikitext and an engine trying to emulate the behavior of a MediaWiki.
http://sweble.org/sites/swc-devel/develop-latest/tooling/sweble/sweble-wikitext
70 stars 27 forks source link

The title `Template:Did you know nominations/Steve Taylor & The Perfect Foil; Wow to the Deadness' contains invalid entities: &_The_Perfect_Foil; #45

Closed kno10 closed 7 years ago

kno10 commented 8 years ago

As the error indicates, links to this page will parse as invalid entites, even when written with space, because &_The_Perfect_Foil; apparently would be a valid XML entity name.

The error is in org.sweble.wikitext.parser.parser.LinkTargetParser.parse(LinkTargetParser.java:180)

Maybe the logic can be changed, and the sanity check moved before the entity matching (e.g. after xmlDecode)?

The line result = StringUtils.trim(result); can probably be removed - afterwards, whitespace is substituted with underscores, and underscores are trimmed again.

hannesd commented 8 years ago

Thanks for the bug report. I can confirm the problem. Moving the sanity check up won't work since it will then also apply to the fragment part. Moving the conversion of space -> underscore down might work. Then the conversion would also not affect the fragment which makes sense. I'll look into it.

hannesd commented 7 years ago

Fixed in version 2.2.0