Hi!
We are working on the Wikispeech extension and have run into an issue on Swedish Wikipedia (svwp) where the page title DOM seems different both from the *displayTitle* returned by the API and from what we see on other wikis.
For example, if we query:
*https://sv.wikipedia.org/w/api.php?action=parse&format=json&page=Apa... https://sv.wikipedia.org/w/api.php?action=parse&format=json&page=Apa&prop=displaytitle&formatversion=2*
we get: *{"title":"Apa","pageid":3877894,"displaytitle":"<span class="mw-page-title-main">Apa</span>"}}*
However, in the actual DOM on svwp, the title appears wrapped differently, for example: *<span lang="sv" dir="ltr"><span class="mw-page-title-main">Apa</span></span> + editsection span*
So it adds an extra *<span>*..
What confuses us is that this seems to behave differently from other wikis we have tested, such as enwp, where the title DOM appears as the *displayTitle* structure.
Is there something specific about svwp that causes the page title DOM to be wrapped differently from other wikis, or has there been any updates regarding the structure? Kind regards, *Viktoria Hillerud Ahlbäck* *Developer* Wikimedia Sverige (WMSE)
Can you describe better what you mean by "this appears to be different from other wikis"? The following two API requests return the same structure for me:
https://en.wikipedia.org/w/api.php?action=parse&format=json&page=OLP...
https://sv.wikipedia.org/w/api.php?action=parse&format=json&page=Apa...
Note that there is also a `&parser=` option to both of these queries. `parser=parsoid` currently generates different output than `parser=legacy` for these queries, which should be fixed by https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1264213 which is riding the train this week.
The output for article titles changed in 2022 (T306440) and then again in November of last year (T36514) with the title on the "edit" page being fixed more recently (gerrit 1239559).
But in this case the issue flagged seems to be the fact that the title code in Article doesn't match the code which is run in ApiParse for the displaytitle. Article writes to the OutputPage, while ApiParse displays the value in the ParserOutput. Only the OutputPage code path currently passes in the title language, which could probably be fixed.
Another issue is that {{DISPLAYTITLE:xxxx}} and/or -{T|....}- don't actually separate the namespace from the title, and so the output is very different when you use either of those functions in wikitext. That's T314399 (OutputPage::getUnprefixedDisplayTitle() is unreliable) which is its own fun time.
--scott
Some additional useful information to add to the technical details Scott shared in his email. The reason you are noticing these changes now is because we rolled out Parsoid-based-read-view rendering to svwiki recently [1]. But, enwiki is still not using Parsoid (but will also start using Parsoid in the coming months), so the difference you are seeing between svwiki and enwiki is because of this.
In his email, Scott pointed to the phab task / gerrit patch [2] that introduced the extra span in the DOM structure. Separately, he also pointed to a change [3] that might roll out soon that might make Parsoid and the old parser emit the span wrapper identically. But, as he notes, the API and the read view code paths could be reconciled so that the outputs could match better. Till we make that fix, you will notice the difference between the API and the DOM structure.
Hopefully this helps clarify why you are noticing this now.
Subbu.
1. https://sv.wikipedia.org/wiki/Wikipedia:Bybrunnen/Massmeddelanden#Migration_... 2. https://phabricator.wikimedia.org/T36514#11350666 3. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1264213
On 3/30/26 18:56, Viktoria Hillerud via MediaWiki-l wrote:
Hi!
We are working on the Wikispeech extension and have run into an issue on Swedish Wikipedia (svwp) where the page title DOM seems different both from the *displayTitle*returned by the API and from what we see on other wikis.
For example, if we query:
*https://sv.wikipedia.org/w/api.php?action=parse&format=json&page=Apa... https://sv.wikipedia.org/w/api.php?action=parse&format=json&page=Apa&prop=displaytitle&formatversion=2*
we get:
*{"title":"Apa","pageid":3877894,"displaytitle":"<span class="mw-page-title-main">Apa</span>"}}*
However, in the actual DOM on svwp, the title appears wrapped differently, for example:
*<span lang="sv" dir="ltr"><span class="mw-page-title-main">Apa</span></span> + editsection span*
So it adds an extra *<span>*..
What confuses us is that this seems to behave differently from other wikis we have tested, such as enwp, where the title DOM appears as the *displayTitle*structure.
Is there something specific about svwp that causes the page title DOM to be wrapped differently from other wikis, or has there been any updates regarding the structure?
Kind regards, *Viktoria Hillerud Ahlbäck* /Developer/ Wikimedia Sverige (WMSE)
MediaWiki-l mailing list --mediawiki-l@lists.wikimedia.org To unsubscribe send an email tomediawiki-l-leave@lists.wikimedia.org https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
mediawiki-l@lists.wikimedia.org