Last modified: 2014-09-18 13:15:52 UTC
In this module : https://test2.wikipedia.org/wiki/Module:Auteur I display some errors (red colored) to guide the user to use the template. I can display them in some namespaces and not in others. But this is not OK because some errors must disappear when the user validate the page, then they must not disturb the simple reader. Then I ask for a way to detect EDIT state from Lua level.
Hi Rical, unfortunately this report is not very useful because it does not describe the problem well. If you have time and can still reproduce the problem, please read https://www.mediawiki.org/wiki/How_to_report_a_bug and add a more useful description to this report, by providing good steps to reproduce, a minimal testcase, actual outcome, and expected outcome. Thanks!
In complex templates, users can use bad arguments names, or mistake about the value of a century, and so on. Scribunto permit to detect these errors to assist the user. This is a new service to users, at Lua level. The module https://test2.wikipedia.org/wiki/Module:Auteur can display messages like : ⦁ Error: Wikidata element is not found. ⦁ Error: This argument is required but absent : initiale. Should define it. ⦁ Error: The parameter BirthYear is unknown in this template. The known argument birthyear is it the one you need ? ⦁ Error: The life of the author is too long. These messages are usefull when a user modify the page, but must disappear for simple readers. To hide messages, the module must know if the page is in edit state. I search some hours and ask in some places, but I don't find how to detect the edit state and nobody answers.
I am sory, I changed the state to normal, but now I correct by revert it to enhancement.
This bug is not only about data from Wikidata. It's about any edit in any wiki. The result is a value that a scribunto module can read to adapt its work in the edit state of the page. The module must display error messages only in edit mode.
If someone cares enough about this to actually implement it, it should be easy enough to do along the lines of Gerrit change #93019, using $this->getParser()->getOptions()->getIsPreview(). And you could as well throw in access to $this->getParser()->getOptions()->getIsSectionPreview() too. Personally, though, I don't really see the point of modules changing their output based on whether it's a preview or not.
I think it would be a bad idea to allow the previewed version of a page to look different from what it will save to. It could confuse users who see a bunch of changes when they just make one little one, not to mention the field day vandals could have with it.
(In reply to Jackmcbarn from comment #6) > I think it would be a bad idea to allow the previewed version of a page to > look different from what it will save to. 1 - Each time a user edit any page in any wiki, he sees some alert panels. The module:Auteur do the same one alert panel, just before the normal output. 2 - The goal of the info "edit-state" is exactly to permit to automatic mask this panel to not disturb simple readers, without the risk to keep the panel. 3 - Without the info "edit-state" and the automatic masking, the editing user can forget to mask the panel, which is not so easy. Then the module must catégorize the page to help admins to correct the page and mask the panel.
Okay, a few new things to consider: * It's already possible to see if a page is being previewed by looking at {{REVISIONID}}. (I'm not sure this is a good thing, but it's true). * Some issues are severe enough that they should be displayed even if the page is saved, like a missing required template parameter. * In your use case, you say that the purpose is to keep readers from being confused if the page is saved with errors still in it. However, this would lead to the next editor being confused, since they'd have no idea why errors suddenly appeared when they made some unrelated change.