magnusmanske / listeria_rs

Repo for the Wikimedia Listeria bot
https://listeria.toolforge.org/
23 stars 6 forks source link

invoke cite web error #128

Closed lorinczz closed 1 week ago

lorinczz commented 1 month ago

src/reference.rs change causes Lua error due to invalid syntax. Example https://hu.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:Wikidata/Friss_hal%C3%A1lesetek&oldid=27296125 Changing to {{#invoke:cite web|| fixes the issue according to https://en.wikipedia.org/wiki/Module:Cite_web.

mbch331 commented 1 month ago

Issue also occurs on Dutch Wikipedia where we also don't have a module Cite web. https://nl.wikipedia.org/w/index.php?title=Gebruiker:Spinster/Nederlandse_kunstenaars_publiek_domein_2017&curid=4752441&diff=67835146&oldid=67711921 And the solution isn't to create the module. Just because one wiki has a module, not all Wikipedias need to have that module.

sjoerddebruin commented 1 month ago

Any update on this?

pere-prlpz commented 1 month ago

Same issue in Catalan Wikipedia. We don't have module cite web but we could create it. However, the syntax ListeriaBot is using is not the same as https://en.wikipedia.org/wiki/Module:Cite_web, which requires a blank first parameter.

pere-prlpz commented 1 month ago

I've checked if the syntax error could be solved wiki side, but it seems it can't.

Therefore, we (all wikis that can use cite web module) need ListeriaBot to fix the syntax and use || instead of | as lorinczz said 3 weeks ago.

pere-prlpz commented 2 weeks ago

I hate to insist on this but the option to add references looks great and it could do a lot to improve automatic lists, but to actually use it in any Wikipedia this bug needs to be fixed. I suppose developing the ref option took some non negligible amount of work, and the only think that seems to be needed in ListeriaBot to start using it is to change | with || when using invoke cite module.

pere-prlpz commented 2 weeks ago

And I don't even know the programming language used to write ListeriaBot, but my guess is that the line 117 of https://github.com/magnusmanske/listeria_rs/blob/master/src/reference.rs

"{{{{#invoke:cite web|url={}|title={}",

should be replaced with:

"{{{{#invoke:cite web||url={}|title={}",

Can anybody check and do it, please? Thank you.

vlakoff commented 1 week ago

There are two different issues:

magnusmanske commented 1 week ago

Sorry it took me so long to work on this. I think the bot works correctly, as it is, on many wikis, so I believe a "blacklist" of some kind would suffice. Something like: WIKI - USE_INVOKE - USE_CITE_WEB

Would that be sufficient?

What would be a list of wikis that need to go into that list? From this thread I can see:

vlakoff commented 1 week ago

frwiki doesn't have the module, but has a {{Cite web}} template (which is a redirect to our locale template), and we do recognize English parameter names, in order to support the foreign articles that are imported without editing the templates.

vlakoff commented 1 week ago

How about automatically testing page existence on the wiki:

But maybe it's not possible to automatically test and a manual list is required?

magnusmanske commented 1 week ago

I am going with the manual approach for now, can be amended later if it causes too much trouble.

pere-prlpz commented 1 week ago

In which wikis does the format {{#invoke:cite web| with a single bar works? As far as I know, this format doesn't work in any wiki, including enwiki. If it worked in some wikis we could just copy the same module in other wikis. That was the first approach but it didn't work.

lorinczz commented 1 week ago

It can't work, because it is invalid syntax.

vlakoff commented 1 week ago

Confirmed working on frwiki: https://fr.wikipedia.org/w/index.php?title=Projet:Wikidata/Listes/D%C3%A9c%C3%A8s_caus%C3%A9s_par_la_maladie_%C3%A0_coronavirus_2019&diff=prev&oldid=218399139

(The number format change is unrelated.)

pere-prlpz commented 1 week ago

In frwiki ListeriaBot uses now template cite web (instead of invoke cite web with a missing bar, as it used to do).

However, in cawiki it does not use cite web despite of it existing in cawiki. Please notice that the test I made includes one reference that in frwiki is wrapped in cite web and in cawiki is just a bare url.

How can we make ListeriaBot to use template cite web in cawiki?