Page MenuHomePhabricator

Parse warnings not visible with live preview
Closed, ResolvedPublic

Description

Steps to reproduce:

There should be an error like Invalid or unsupported value for property background-image... but it's only visible when live preview is disabled.

Event Timeline

[[https://www.mediawiki.org/w/api.php?action=help&modules=parse|action=parse&prop=parsewarnings]] can be used for getting the warnings wikitext (although it doesn’t yield anything for this particular page, but I don’t get any warning using the normal preview, either).

[[https://www.mediawiki.org/w/api.php?action=help&modules=parse|action=parse&prop=parsewarnings]] can be used for getting the warnings wikitext

It can but the live preview doesn't do it.

although it doesn’t yield anything for this particular page, but I don’t get any warning using the normal preview, either

Most warnings prevent saving the page (although I guess I could have made something that surpasses parser limits), which is why step 3 says to change the domain.

[[https://www.mediawiki.org/w/api.php?action=help&modules=parse|action=parse&prop=parsewarnings]] can be used for getting the warnings wikitext

It can but the live preview doesn't do it.

This is why this task isn’t already resolved. :) I just wanted to mention it to note that the API is ready and only the JavaScript side needs work.

although it doesn’t yield anything for this particular page, but I don’t get any warning using the normal preview, either

Most warnings prevent saving the page (although I guess I could have made something that surpasses parser limits), which is why step 3 says to change the domain.

Oh, somehow I missed that point. Anyways, I tested with other errors (now also with this one), so I can confirm it works on the API side. (Other tests also revealed that it returns wikitext rather than HTML, so it should be parsed once again before outputting.)

I do have a patch for this.. somewhere...
I believe I never completed it, because i had wanted to use templated html instead, but then I never finished that rework.

Change 597262 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/core@master] warnings and header for livepreview

https://gerrit.wikimedia.org/r/597262

Change 597262 merged by jenkins-bot:
[mediawiki/core@master] LivePreview: Show parse warnings and preview header/warning

https://gerrit.wikimedia.org/r/597262

matmarex assigned this task to TheDJ.

@matmarex & @TheDJ : hi, the MediaWiki message PreviewNote with parseDom() was added with commit, but LivePreview fails to parse it on frwiki. jqueryMsg.wikiTextToAst fails when it encounters the character {. It seems that wikitable syntax is not supported. Should the community edit the system message?

mediawiki.jqueryMsg: previewnote: Parse error at position 26 in input: <div id="previewnote-fr">
{|

@Lofhi I think we didn't anticipate that many wikis would have complex overrides for this message… For https://fr.wikipedia.org/wiki/MediaWiki:Previewnote in particular, the image would also be a problem. Only a small set of wikitext syntax is supported in messages that are used client-side: https://www.mediawiki.org/wiki/Manual:Messages_API#Feature_support_in_JavaScript

Looks like this is now filed as T266311, let's continue there. We should probably handle this message differently.