Context
We want to enable the community to influence how autonames are created based on the content of citation templates if used in a reference. This is a first step to add the basic functionality to the code.
Implementation
- Add a new feature flag to hide the functionality of increment 2 --> we decided to put increment 2 behind the same feature flag as increment 1 wgCiteCitationTypeAutoNames
- Add a new method to ve.dm.MWReferenceKeyGenerator
- It takes at least the InternalItemNode of the reference and the name of the autoname template as input
- Default to a hard code template name for now ( e.g. Template:Autoname )
- Clones and manipulates the TransclusionNode inside of the InternalItemNode to render the autoname template with the original parameters as in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/1329635
- Add QUnit tests for the method
- Mock the InternalItemNode structure to tests what happens if the internal structures are / or are not as expected
- Mock the ve.ui.MWPreviewElement to test what happens if the Preview returns issues / or no issues ( e.g. if the autoname template does not exist )
- Call method hidden behind the new feature flag in generateName
- Adapt existing tests to reflect the new autonames