Page MenuHomePhabricator

Parsoid ignores template-generated {{DISPLAYTITLE}} (like {{Lowercase title}} on enwiki)
Closed, ResolvedPublic

Description

API delivers the proper display title:
https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=EBay&inprop=displaytitle

in Parsoid HTML from:
http://parsoid-lb.eqiad.wikimedia.org/enwiki/EBay

we have:
<title>EBay</title>

instead of:
<title>eBay</title>


Version: 1.22.0
Severity: minor

Details

Reference
bz49075

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:43 AM
bzimport set Reference to bz49075.
bzimport added a subscriber: Unknown Object (MLST).

Ebay is a redirect to EBay. The page "Ebay" does not have a {{displaytitle}} on it.

https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=EBay&inprop=displaytitle has the correct displaytitle.

So does https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=Ebay&inprop=displaytitle&redirects which follows the redirect

If you visit https://en.wikipedia.org/w/index.php?title=Ebay&redirect=no the title is displayed as "Ebay".

I think this bug is INVALID. Reopen if you disagree

Kelson set Security to None.

@Bawolff
Sorry my example was wrong. I have fixed the task description.

The reason why I have open that task is that due to this problem, Parsoid backend is also providing the wrong title like you can see here:
http://parsoid-lb.eqiad.wikimedia.org/enwiki/EBay

As a consequence offline dumps of WPEN (and all other projects) provide also wrong titles...

Sorry my example was wrong. I have fixed the task description.

It's still wrong, the query you now link doesn't show any displaytitle in the result.

Adding the proper inprop=displaytitle (https://en.wikipedia.org/w/api.php?action=query&prop=info&titles=EBay&inprop=displaytitle) does show the displaytitle as "eBay", which still makes this bug invalid.

The reason why I have open that task is that due to this problem, Parsoid backend is also providing the wrong title like you can see here:
http://parsoid-lb.eqiad.wikimedia.org/enwiki/EBay

As a consequence offline dumps of WPEN (and all other projects) provide also wrong titles...

I have no idea why Parsoid might be giving a wrong title. You'd have to ask them.

@Anomie
Great! Thank you for this, then this task seems to be for the Parsoid team :)

Kelson renamed this task from By ignoring {{DISPLAYTITLE}}, API does not deliveri the right "displaytitle" value to Parsoid seems to ignore {{DISPLAYTITLE}}.Feb 11 2015, 2:52 PM
Kelson updated the task description. (Show Details)
Kelson edited projects, added Parsoid; removed MediaWiki-Action-API.

You'll want to reopen the bug then, and edit the description to make it more relevant to the Parsoid folks.

We do in fact generate a <meta> tag for {{DISPLAYTITLE}}. For example:

$ echo '{{DISPLAYTITLE:foo}}' | tests/parse.js
[...]
<meta property="mw:PageProp/displaytitle" content="foo"/>
[...]

As a workaround you can look for that and use it to update the <title>.

(For Parsoidistas: this is done in ext.core.TemplateHandler.js)

Oh, also:

$ echo '{{DISPLAYTITLE:foo}}' | tests/parse.js --page=Bar
[...]
<title>foo</title>
[...]

So I'm not seeing a bug here. Can you provide a better test case?

I think that Parsoid correctly sets <title> when {{DISPLAYTITLE}} is used, but not when it comes from a template. The EBay page is using {{Lowercase title}}, for example.

@marcoil: ah. Yeah, there's a fixme in ext.core.TemplateHandler.js:

			// FIXME: We don't know if this is a magic word at this point.
			// Ex: {{ {{echo|DEFAULTSORT}}:foo }}
			//     {{ {{echo|lc}}:foo }}
			// This requires more info from the preprocessor than
			// we have currently. This will be handled at a later point.

although this sounds like we're passing {{lowercase title}} off to the mediawiki API and so never seeing the DISPLAYTITLE at all. Hm.

Is it worth querying the action API for displaytitle on every parse?

Alternatively, is there a way to piggyback a request for displaytitle (and defaultsort, while we're at it) on to the expandtemplates API call we're already making?

cscott renamed this task from Parsoid seems to ignore {{DISPLAYTITLE}} to Parsoid ignores template-generated {{DISPLAYTITLE}} (like {{Lowercase title}} on enwiki).Feb 11 2015, 4:00 PM
gerritbot subscribed.

Change 189994 had a related patch set uploaded (by Cscott):
T51075: Handle template-generated DISPLAYTITLE and DEFAULTSORT.

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

Patch-For-Review

Change 189994 merged by jenkins-bot:
T51075: Handle template-generated DISPLAYTITLE and DEFAULTSORT.

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

Looks like this was merged after the Wed deploy window, so it won't go live until Monday Feb 16.

ssastry assigned this task to cscott.
ssastry removed a project: Patch-For-Review.