Page MenuHomePhabricator

Preview shows wikitext instead of page title on test.wikipedia.org
Closed, ResolvedPublicBUG REPORT

Description

When editing any page on the test wiki it shows the page title at the top, but as soon as I preview it the following text appears:

{{#ifeq:{{NAMESPACE}}|User | {{#switch:{{SUBPAGENAME}} |monobook.js|monobook.css|modern.js|modern.css|common.js|common.css=Editing {{BASEPAGENAME}}'s personal interface page |#default=Editing {{#titleparts: {{PAGENAME}} | 1 }}'s <!-- it's hard to identify the current page title if all we see is the user name and not the subpage name -->{{#ifeq: {{SUBPAGENAME}} | {{PAGENAME}} | user page | sub page "{{SUBPAGENAME}}" }} }} | Editing "$1" }}

Now I haven't checked when it happens. It happened for me on my user page and on the main page (just preview suffices). But now it was strange. I tested first on the main page and it happened, then on my user page and it worked fine. After that I tested a third page and the main page again, both times the error did not appear. But then rerequesting the preview issued the error and then also on the user page. It doesn't seem to happen on the English Wikipedia.

I'm using the Firefox Nightly from 2015-07-06 on Fedora 20 if that depends on the browser.

Event Timeline

XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
XZise added a project: MediaWiki-Page-editing.
XZise subscribed.

Confirming for e.g. https://test.wikipedia.org/w/index.php?title=Page375&action=edit both when logged in and not. Cannot reproduce on mediawiki.org or test2 which are also running wmf13.

Aklapper renamed this task from Preview shows wikitext instead of page title to Preview shows wikitext instead of page title on test.wikipedia.org.Jul 9 2015, 2:22 PM
Aklapper triaged this task as Low priority.
Aklapper set Security to None.
Ciencia_Al_Poder subscribed.

This happens when using LivePreview (check for that in Preferences, under Editig tab). Using normal preview works without this problem.

When hitting preview, I see this in the error console after a XMLHttpRequest to the server:

mediawiki.jqueryMsg: editing: Parse error at position 0 in input: {{#ifeq:{{NAMESPACE}}|User
| {{#switch:{{SUBPAGENAME}}
|monobook.js|monobook.css|modern.js|modern.css|common.js|common.css=Editing {{BASEPAGENAME}}'s personal interface page
|#default=Editing {{#titleparts: {{PAGENAME}} | 1 }}'s <!-- it's hard to identify the current page title if all we see is the user name and not the subpage name -->{{#ifeq: {{SUBPAGENAME}} | {{PAGENAME}} | user page | sub page "{{SUBPAGENAME}}" }}
 }}
| Editing "$1"
}}

What's being displayed is the raw message of https://test.wikipedia.org/w/index.php?title=MediaWiki:Editing&action=edit

Apparently, the message is being parsed on client-side but it's too complex.

on en.wp that message isn't so complex: https://en.wikipedia.org/w/index.php?title=MediaWiki:Editing&action=edit so this doesn't happen on wikipedia.

The problem happens executing this line: mw.message('editing').text() and you can see the plain message with mw.message('editing').plain()

I'd say this is not a bug, and mw.message isn't supposed to handle such complex parser functions.

On the other hand, someone should probably clean out https://test.wikipedia.org/w/index.php?title=MediaWiki:Editing&action=edit

TheDJ subscribed.

I'd say this is not a bug, and mw.message isn't supposed to handle such complex parser functions.

It isn't, but it could handle it more gracefully of course. I'll see if I can fix that.

Once again preparsed messages on server side would solve this problem.

Oh yes sorry that is with live preview forgot to add that (although I didn't test it without it).

https://test.wikipedia.org/wiki/MediaWiki:Editing got deleted so it is no longer reproducible on this project.

Fomafix changed the subtype of this task from "Task" to "Bug Report".Mar 2 2019, 2:15 PM
Daimona claimed this task.
Daimona subscribed.

This is already fixed on MW master. For reference, repro steps that I followed on my local wiki:

  • Replace MediaWiki:Editing with the following text (same as testwiki in 2015):
{{#ifeq:{{NAMESPACE}}|User
| {{#switch:{{SUBPAGENAME}}
|monobook.js|monobook.css|modern.js|modern.css|common.js|common.css=Editing {{BASEPAGENAME}}'s personal interface page
|#default=Editing {{#titleparts: {{PAGENAME}} | 1 }}'s <!-- it's hard to identify the current page title if all we see is the user name and not the subpage name -->{{#ifeq: {{SUBPAGENAME}} | {{PAGENAME}} | user page | sub page "{{SUBPAGENAME}}" }}
 }}
| Editing "$1"
}}
  • Enable Live Preview
  • Go to a random page, add random text, click "Show changes"

I can see the message parsed correctly, regardless of whether it's for a mainspace page, a user page, or a user JS/CSS page.

Reopen. The problem still exist. The message text in MediaWiki:Editing uses the extension ParserFunctions. This works on server side parsing but not on parsing by mediawiki.jqueryMsg used by mediawiki.action.edit.preview.

Reopen. The problem still exist. The message text in MediaWiki:Editing uses the extension ParserFunctions. This works on server side parsing but not on parsing by mediawiki.jqueryMsg used by mediawiki.action.edit.preview.

I could not verify this locally. Can you please confirm whether the reproduction steps at T105214#7376465 are correct?

Reopen. The problem still exist. The message text in MediaWiki:Editing uses the extension ParserFunctions. This works on server side parsing but not on parsing by mediawiki.jqueryMsg used by mediawiki.action.edit.preview.

I could not verify this locally. Can you please confirm whether the reproduction steps at T105214#7376465 are correct?

Uh, I can answer my own question... No, I also used "show changes" here but the issue is only with "show preview".

I think the best solution is to put the title in a special element inside of the firstHeading. Live preview can then just replace the content in this element and keep the rest of the firstHeading unchanged. But this would only solve the problem on the firstHeading, not on the HTML title. The update of the HTML title can also dropped completely. Its just a preview and the result including any embedded HTML is already visible on the firstHeading.

Change 723672 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/core@master] [WIP] Update only title in firstHeading on live preview

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

I think the best solution is to put the title in a special element inside of the firstHeading. Live preview can then just replace the content in this element and keep the rest of the firstHeading unchanged. But this would only solve the problem on the firstHeading, not on the HTML title. The update of the HTML title can also dropped completely. Its just a preview and the result including any embedded HTML is already visible on the firstHeading.

I don't think that's a good solution. The problem will still be visible and prominent, and you remove part of the feature on wikis that don't experience this problem.

Possible fixes for this problem that come to my mind are:

  • A second call to action=parse with the message, maybe conditionally only if it detects unparsed code.
  • A new parameter to action=parse where you can specify a message or list of messages to parse with the title

I don't think that's a good solution. The problem will still be visible and prominent, and you remove part of the feature on wikis that don't experience this problem.

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/723672 removes the feature of update the title in the HTML header on a preview. But this affects only the lower case of the first character. The rest of the features of a display title like HTML is not visible on the HTML title. I think this is acceptable.

What do you mean with "The problem will still be visible and prominent"? https://gerrit.wikimedia.org/r/c/mediawiki/core/+/723672 prevents problems with extension ParserFunctions by not changing the messages on JavaScript side.

I misunderstood your earlier message, and I though the problem would still be present on the first heading, which apparently will be fixed with your change. Disregard what I said, then

The feature request to support complex parser functions inside this interface message, was previously declined at T95711: LivePreview: Page heading for "Creating" should support parser functions.

Before we accept this change, I would like this task to clearly document the use case for why this syntax is needed, and to confirm that this is not something that can be trivially done in a different way using other capabilities in the platform, and not also implementing something that is going to bring in additional trouble to support once it works.

I've approved the patch since it actually simplifies the code a lot, and it just so happens that complex parser functions work with the method it uses.

Change 723672 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Only update title part of firstHeading on live preview

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