Page MenuHomePhabricator

Displaying mapframes for geocoordinate on client requires preprocessing by the user
Closed, ResolvedPublic8 Estimated Story Points


As pointed out by @Tpt in T210926#4999461:

If Wikibase Client tries to format a coordinate via entity:formatStatements() in Lua, the editor will need to manually preprocess the result of these expressions. That is unacceptable, as it breaks the current way these constructs are used, it is undocumented and also very inconvenient to use. The {{#statements:…}} parser function seems to be unaffected by this.

As a solution, we should make sure we Parser::preprocess all (or just if <maplink> is in there?) wikitext generated in StatementTransclusionInteractor::formatSnaks. For this to work, we will need to pass the current Parser instance through to that function :/

As (AFAIR) re-preprocessing already pre-processed wikitext is a noop, we can safely do this change.

Steps to reproduce

  1. Set up the Kartographer extension on your client wiki and confirm it is working.
  2. Enable the useKartographerMaplinkInWikitext Wikibase Client settings.
  3. Add a globe coordinate value to an item (needs to be an earth coordinate)
  4. Access that information on a client wiki page via the following Lua snippet: mw.wikibase.getEntity( 'yourEntityId' ):formatStatements( 'yourGlobeCoordPropertyId' ).value

Right now this is going to show you <maplink …> on the page, while it should output an interactive map showing the coordinate.

Event Timeline

hoo removed the point value for this task.
hoo set the point value for this task to 8.

I can’t manage to reproduce this – both on my local wiki and on Wikidata, the {{#statements}} snippet gives me a working maplink, not a broken mapframe.

This comment was removed by hoo.

Seems I had this quiet wrong initially… no idea what I tested then. Anyway this is only affecting Lua, not the parser function and we don't ever output <mapframes> (just <maplink>). We might still want to fix this in the way laid out in the description, but we could also use frame:preprocess as provided by Scribunto in the relevant Lua functions (entity:formatStatements, mw.wikibase.formatValue, and mw.wikibase.formatValues) .

Change 503375 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] Allow using Kartographer maps via Lua without preprocessing

I set up a beta test on – after the fix is deployed, purging that page should show a working maplink. (I’ve archived the current output for comparison.)

Change 503375 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Allow using Kartographer maps via Lua without preprocessing