Since we now have an occurance of InterfaceText that isn't
optional (namely Set#label, which must not be null) move the
"null" value type to all other uses of InterfaceText instead
of in InterfaceText itself.
Change-Id: I92786492a37d907aad446655704ea1b52938ab21
* Inside a Set object, label is no longer optional
* The "sets" container (Root.sets) will be an array instead
of an object. They don't need to have an internal key.
Contrary to Root.params where the key relates to the
parameter key in wikitext.
Change-Id: Iede29d25cd6ecbcf43970e1e45e60e5aac206a95
For invalid keys, pass property path, not just the latest
child.
Changes error:
- Invalid value for "typo"
+ Invalid value for "params.date.typo"
Also cleaned up the concatenation logic for the others to
be more readable (PHP dots vs. string dots):
- 'params.' . $paramName . '.key'
+ "params.{$paramName}.key"
Change-Id: I666e0b22f4b7bacc5b89b0761c74138732f94d73
InterfaceText now defaults to null instead of {en:""} which
was awkward to deal with in the frontend.
As specified:
- label is InterfaceText
- type is a string and must be a one of the recognized types
Updated example for the hypothetical variant of Template:Unsigned
and removed other no longer needed example.
HTML output has been revised per conversation with Trevor,
James and Timo:
- Not sortable.
- Add label to html output.
- Aliases in the main parameter column (one per line),
but muted in styling.
- Add type to html output.
The css module styles content from the server, not content
generated by javascript. Moved module to position => top to
fix flash of unstyled content.
Change-Id: I16d3f9e460c5513935b9b55fe4cec0092b38e6c2
I ran into countless random exceptions and errors locally due to
cache I built up over time that was no longer valid. Though in
approved commits in the repository there is only 1 version as of
now, I'm sure we will make changes in the future that require a
cache invalidation since getHtml needs to be able to make
assumptions about what properties exist.
Also fixed a bug in the parse() method where the 'deprecated'
property is asserted the wrong way around. Added a test for it.
Change-Id: I5f61d6030578a711909435c8b996373e9aaa5178
* Add unit tests for all types of invalid input we check for.
* Add unit tests for all types of input we expand or otherwise
normalise.
* Implement InterfaceText expansion/normalisation.
* Fix bug that caused a string value in the root description property
to be considered invalid (it only accepted an object, it should
accept both).
Change-Id: I5a15080f1f924451a9dde8af96ea2922011981ec
Registers a parser tag <templatedata> that should have a JSON
blob as content. The blob is then validated and normalised when
MediaWiki parses the page (e.g. during save and preview).
If there are validation errors, the save is aborted from the
extension hook and an error is displayed.
If all goes well, the normalised blob is stored in the database
(which can be retrieved through the API). And an HTML
representation of the template parameters is returned to the
wikitext parser to show where the <templatedata> was in the page.
The blob format is specified in spec.templatedata.json and
is validated in TemplateDataBlob::parse.
Bug: 44444
Change-Id: Icf305892a9512545a63f5a5280cc0d340c61585f