|thiemowmde added a comment.|
We should aim for a solution that solves all these problems. Regular expressions are problematic (security and performance risk, very high complexity) and should be avoided. I would love to see us using Lua snippets for such case-by-case formatting. Using a real programming language is the only solution that will solve all possible problems, and Lua is perfect because it is build for exactly such use cases.
Instead of the formatter URL (P1630) there would be an other property with a link to an (edit-protected) Lua module.
The same Lua module could also provide an actual parser and validator in addition to the formatter. Inputs and outputs are always strings and nothing else, but even this would already help a lot. For example: It would be possible to paste a full IMDb URL, and the parser would strip the unwanted stuff. The validator would make sure only real IMDb identifiers are pasted. And the formatter would turn this back into a URL.
Yea, "but performance", I hear you. Any other idea that would be as awesome as using Lua?
Cc: thiemowmde, Pasleim, Esc3300, Aklapper, Stigmj, Nikki, hoo, Lydia_Pintscher, D3r1ck01, Izno, Wikidata-bugs, aude, Mbch331
_______________________________________________ Wikidata-bugs mailing list Wikidatafirstname.lastname@example.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs