Page MenuHomePhabricator

TemplateData: Provide information about preferred formatting of transclusions
Closed, DuplicatePublic

Description

For the serialization of new transclusions we'd like to have information about the preferred formatting from TemplateData:

  • all parameters on a single line vs. one parameter per line
  • (possibly) preferred order of parameters by key

Version: unspecified
Severity: enhancement

Details

Reference
bz62217

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:57 AM
bzimport added a project: TemplateData.
bzimport set Reference to bz62217.

(In reply to Gabriel Wicke from comment #0)

For the serialization of new transclusions we'd like to have information
about the preferred formatting from TemplateData:

  • all parameters on a single line vs. one parameter per line

Sounds sensible.

  • (possibly) preferred order of parameters by key

This is already done for display purposes; I imagine we should just re-use the same order?

  • Bug 63813 has been marked as a duplicate of this bug. ***

Proper formatting actually requires more information than just single line vs. one parameter per line:

  • Whitespace before pipe: For templates that should have one parameter per line this will be "\n", for single line templates it can be the empty string or just a space.
  • Whitespace after pipe: In most cases either an empty string or just a space.
  • Whitespace before equal sign: This may vary widely: Empty string, one space, many spaces (depending on the length of the parameter name, to align the equal signs).
  • Whitespace after equal sign: In most cases either an empty string or just a space. But this may depend on whether the parameter has a value or not, i.e. it should be possible to have a space after the equal sign iff the value isn't empty.

One important example is Vorlage:Personendaten (de.wikipedia), which provides meta-data about persons (it predates Wikidata but still fits our needs much better and thus is still actively used): To make parsing these data as easy as possible the whitespace used in the template transclusion should follow exactly the documentation. This means: When somebody uses VE to insert this template, another user will make an edit just to remove the spaces. So it should be possible to tell VE just not to insert them in the beginning.

Proper formatting actually requires more information than just single line vs. one parameter per line

Yes, and we are not going to implement that. We aren't going to give the community tools to enact their epic, pointless wikitext style edit wars with each other through config settings.

Though admittedly this is really minor issue, it has a huge impact on whether VisualEditor is accepted by power users or not. Because of this issue it is actually frowned upon to create biographies with VE in de.wikipedia, users have been told already to use the normal source code editor instead.

Change 243138 had a related patch set uploaded (by Eranroz):
Introducing template format

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

eranroz set Security to None.

BTW -Question about the "real-world" use: I think that block (non-inline) templates are infobox and (almost) only infobox? if so, we can use this as heuristic for creating a bot to fill the format field in all existing templates quite easily.