[go: up one dir, main page]

Page MenuHomePhabricator

Properly inject the page and revision id when rendering Kartographer maps
Open, Needs TriagePublic

Description

Wikibase renders Kartographer maps via CachingKartographerEmbeddingHandler which is typically used in contexts where we don't have access to the page title/ revision id we're rendering for (as the Wikibase formatter stack is supposed to be decoupled from these specifics). Currently this is being worked around by just assuming the revision id is the latest revision and the page title is the main request title (RequestContext::getMain()->getTitle()).

In order to fix this I propose:

  1. Leaving the preview formatter (SnakFormatter::FORMAT_HTML_VERBOSE_PREVIEW) as is, as I don't see a good way to address this and its only used for previews while editing (the API used for this currently doesn't know which page it operates on, but for previews that should be fine, as they don't intend to put data into the parser cache anyway).
  2. Allow (optionally, due to the restrictions we face regarding preview html) injecting the page title and revision id into CachingKartographerEmbeddingHandler
  3. Make the html formatter (SnakFormatter::FORMAT_HTML) output a simple, but easy to identify html snippet containing the coordinate and potential metadata
  4. In repo, use the ContentAlterParserOutput hook to extract the simple html references and properly render the Kartographer maps at this point (where we have access to the page title and revision id we're parsing for). This would still be using CachingKartographerEmbeddingHandler.
  5. The ParserOutput handling for Kartographer maps (GlobeCoordinateKartographerDataUpdater) should be changed to also use the actual page title and revision id (which should be available at that point).