Commit graph

14 commits

Author SHA1 Message Date
James D. Forrester fb34a07c02 Add a wiki-file-name type for file names
Bug: 52652
Change-Id: Ibe8d143abbb607eb71549536aaac6555528813cc
2014-04-28 13:21:53 -07:00
James D. Forrester 5293a6d3da Add 'suggested' status type for parameters
This is a status for parameters which are not 'required' but are recommended
to be high value, if not always used, by downstream template users. This
commit does not add GUI-related changes to address this, as the interface
probably needs moving from checkbox- to dropdown-based status setting given
that there are now four, rather than three, mutually-exclusive statuses.

Change-Id: I104976e76d5ad6d586d9c818418ba6e16af53506
2014-04-28 11:45:44 -07:00
Siebrand Mazeland 255fc8225f Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I6627353205c79a91da7615833ebfefe3316bff8d
2014-03-28 14:45:07 -07:00
Timo Tijhof ccacbe4b41 license: Add COPYING file for GNU GPL v2
The only file with a license mention so far was ApiTemplateData.php.
It was documented on mediawiki.org[1] as "GPL v2".

[1] https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: I85cdd5d511f8578888127888d11c2642aad49842
2014-03-13 23:19:19 +01:00
Moriel Schottlender 8c27921232 Implement edit interface for TemplateData documentation
This adds a TemplateData manager to the edit page in the Template
namespace.

If a <templatedata> tag already exists, the tool will parse it and
display it in a visual interface that the user can then manipulate in
their own language. If there is no <templatedata> tag, the dialog will
appear empty and allow users to add and tweak their desired template
parameter data.

The tool also allows rudimentary parameter import, which picks up the
parameters from a current template into the GUI to make the user's life
easier when producing TemplateData.

The template documentation editor feature is off by default. To enable it
use $wgTemplateDataUseGUI = true in LocalSettings.

Bug: 50436
Change-Id: I863a8199c0b08cc52b320ed00dcba912dd2aeefc
2014-01-14 18:39:20 -08:00
Timo Tijhof 3ab2b4439a Re-add version_compare (>= 1.22wmf18)
Follows-up 98cf7e35e.

Change-Id: I07a63effb5cdb14e48c6b69780fe71dc24f17fd9
2013-09-20 00:57:00 +02:00
Reedy 98cf7e35e3 version_compare sucks
Change-Id: I13c2eaae2dbf2d4a4f77e17f601a735a5b0d24b0
2013-09-19 19:47:03 +01:00
Timo Tijhof fc9da6c7bf Remove global function gzdecode fallback
Moved into MediaWiki core (as of 1.22alpha) in change f72117e768.

Change-Id: I6383e933b10d8fca2a855c6b3e287264b176abb8
2013-09-19 08:14:06 +00:00
MatmaRex 7bf85a39a1 Remove all references to TemplateInfo
Change-Id: I5ffc8f75140a2c372fc1c64509b13a534fe07479
2013-09-12 11:41:07 +02:00
Reedy 0e4339da86 Add fallback for gzdecode (only exists in PHP >= 5.4.0)
Bug: 54058
Change-Id: I62a843aec4657a3d4895d34535cc2be42d4552fd
2013-09-12 03:55:35 +00:00
Timo Tijhof 5e50116d6d TemplateDataBlob: Implement 'type' and 'label'
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
2013-05-09 02:49:56 +00:00
Timo Tijhof ffd8899def Add unit tests and fix implemention accordingly
* 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
2013-04-22 07:42:49 +00:00
Timo Tijhof 30b4a592c6 API: Transform into a standalone module instead of a query submodule.
Change-Id: Ia858fa43a50ade947e6353d22dc89a519c3da61a
2013-03-30 01:53:39 +01:00
Timo Tijhof b7080c5f90 Initial TemplateData commit
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
2013-03-14 19:19:55 +00:00