[go: up one dir, main page]

Page MenuHomePhabricator

Introduce non-hacky way to format entity ID values as links in edit summaries
Open, Needs TriagePublic

Description

When adding or editing statements, Wikibase automatically adds the value to the edit summary:

Created claim: Oxford Reference overview ID (P12582): 20110803095349707

When the value is an entity ID, it is shown as a link with a nicely formatted label:

Added reference to claim: instance of (P31): human (Q5)

The raw edit summary contains a wikilink like [[Q5]], and then a hook handler formats that link on display.

However, the way the wikilink is emitted is currently a bit hacky. The values are ostensibly formatted for the edit summary as “plain text”; however, the WikibaseRepo.SummaryFormatter service wiring modifies the entity type definitions to replace the formatter factory callbacks, so that an EntityIdPlainLinkFormatter is used to format entity ID values when “plain text” is requested.

This is kinda hacky, confusing (wikilinks aren’t plain text!), and doesn’t work for entity ID values that aren’t registered as full entity types (i.e. EntitySchema values). It would instead be cleaner to introduce a new snak format for edit summaries, alongside plain text, wikitext and HTML. (Note that SnakFormatter:FORMAT_* already includes several variants of HTML, so we could likewise consider the “summary” format to be a variant of wikitext; see also SnakFormat with its two methods getBaseFormat() and isPossibleFormat().)

Event Timeline

I’m not sure if this task is a blocker for T332157: [ES-M2]: Enable new EntitySchema data type on Wikidata or not, so for now I just made it a subtask of T214884: [ES-M2]: [EPIC] Linking EntitySchemas in statements, since it clearly seems related to that (though I don’t think it has to block it either). If we don’t implement this, then edit summaries for EntitySchema values will probably just show a plain text English label or the EntitySchema ID.