Context
In the second increment of the autoname improvements we want to support the auto generation of reference names from Citation template content and enable the community to create patterns on how this content will be used.
User Story
As a Wikipedia VE user,
I want reference names to be generated from structured Citation template content when possible,
so that I can more easily understand, identify, and reuse references in Wikitext without relying on generic auto-generated names.
Acceptance Criteria
- Autonames can be generated from the parameter values of a template transclusion in the reference.
- Communities can configure naming patterns for templates.
- Communities can define a fallback chain of naming patterns for each template.
- When a new reference name is generated, the system evaluates the configured patterns in order until a valid name can be produced.
- If no configured pattern can generate a valid name, the system falls back to the default naming pattern introduced in Increment 1.
- Generated names remain unique within the group.
- Existing references continue to function unchanged.
Limitations
- Only single template transclusions are valid for this use case otherwise we fall back to the default naming pattern
Technical implementation
Different implementations are possible:
- Template that creates an autoname (could use Lua)
- Autoname pattern in Template Data
- Community configuration
See overview table (open for review).
We decided that we will continue with the first option and store the link to the autoname pattern template somewhere.
There are also different options to store these: Overview table (open for review).
NOTE: The following notes handle option 2 and are therefore currently outdated.
- TemplateData needs to be used for the templates.
- We're adding another map to the TemplateData of these templates
- The patterns consist of references to parameter names mixed with delimiter content
- Fallbacks can be added underneath each other ("params" is already part of template data, "autonames" would be added)
e.g.
{
"params": {
"title": {
"type": "line",
"suggested": true
},
"author": {
"type": "line",
"suggested": true
},
"year": {
"type": "line",
"suggested": true
}
},
"autonames": [
["author", "-", "year"],
["author"],
["title", "-", "year"],
["title"]
]
}Open questions
- How do we handle fields that need changes? For example dewiki has all authors in one field. Some templates have no year field but a date field. Possible options/ideas. They could be combined.
- We enable the community to add a lua template: T433468: Spike: Look into the community provided autoname rendering by template (M)
- We do something like https://en.wikipedia.org/wiki/User:Nardog/RefRenamer and predefine a set of likely to be adjusted parameters and do the adaptions in our code. Could be in template data. The definition could look like this:
"autonames": [ ["author", "-", ["date", "transform", "year"]], ["author"], ["title", "-", ["date", "transform", "year"]], ["title"] ]
- Would users want an overview of all autoname definitions?
- Would they want to have the same definition for multiple templates?
- Would the name of the template also be a wanted building block?
- Do we do normalization to the content for the names, lowercase or cut?