mwparserfromhell icon indicating copy to clipboard operation
mwparserfromhell copied to clipboard

filter_wikilinks does not work for links with added suffixes

Open djstrong opened this issue 11 years ago • 4 comments

For wikicode [[link]]s filter_wikilinks returns [[link]] - it should [[link]]s or [[link|links]].

djstrong avatar Jul 28 '14 21:07 djstrong

The link trail depends on the language. For example, the one on the English Wikipedia is different from the Ukrainian one. The filter_wikilinks method should maybe accept the link trail as an argument, otherwise no trail would be recognized.

ricordisamoa avatar Dec 24 '14 22:12 ricordisamoa

filter_wikilinks doesn't do any actual work, it just navigates the tree. This would have to be an argument to mwparserfromhell.parse... I'm really uncomfortable about adding site-specific arguments like this to that function. Maybe we should consider the current behavior correct?

earwig avatar Dec 25 '14 07:12 earwig

I think that extracting links with anchor text is basic function, so should be included.

djstrong avatar Dec 25 '14 17:12 djstrong

@earwig you're right, the link trail would have to be passed to mwparserfromhell.parse. The maintainability of the parser shouldn't be affected as long as it does not implement any site-specific logic. The link trail is a standard MediaWiki feature, and anyway it would be up to the mwparserfromhell users (or to the maintainers of complementary frameworks such as Pywikibot) to pass the appropriate link trail to the parser.

ricordisamoa avatar Dec 25 '14 18:12 ricordisamoa