Commit graph

173 commits

Author SHA1 Message Date
Timo Tijhof 4aaa9dfcf8 Remove default value for 'paramOrder'
When normalising a TemplateData blob for API consumers, we previously
automatically generated the 'paramOrder' with the order of the keys
as they were specified in the JSON blob (which, unlike in JS, is
known to be reliable in PHP).

While this was useful to some extent, it made it mandatory for
Parsoid and VisualEditor to always re-order properties during
edits to match the specified order.

In order to allow the order to remain flexible/unspecified, the
original Specification made paramOrder optional, but during the
implementation I gave it a default, which kind of defeated that
intention. This patch fixes that.

Bug: T138200
Change-Id: Ib40d23dac7e75274083f95a25c5aa1c22dfffb22
2019-01-08 19:55:59 +00:00
Umherirrender 9ac1604d19 Improve param doc
Change-Id: Idc0780dae2748d6353ae7e1731f183307489626a
2019-01-03 00:21:18 +01:00
jenkins-bot 4221945fc9 Merge "Ignore bang magic word in table syntax when guessing parameters" 2018-12-10 23:55:08 +00:00
Sam Wilson 75e54ae999 Ignore bang magic word in table syntax when guessing parameters
Three-braces-and-a-bang can be a table starting construct in templates.

This also fixes an overlooked bug in which the test wasn't checking
array element key names.

Bug: T157029
Change-Id: I69ed4fc9fe3bb126b7b39abea0f58ad56adf3885
2018-11-27 11:46:23 +08:00
Ed Sanders 822d0cd345 Rename module editPage→editTemplatePage, create minimal new editPage module
VisualEditorPluginModules loads whenever VE loads, so create a minimal
loader page to check if we are in the template namespace before loading
the rest of the TemplateData init code.

Bug: T208765
Change-Id: Id127eb4a2472a6ce9da7672f9237b182cf6be2eb
2018-11-24 00:14:03 +00:00
jenkins-bot db3d73bc84 Merge "eslint: Introduce wikimedia/qunit ruleset" 2018-11-15 23:57:55 +00:00
Ed Sanders 9a8c807f51 eslint: Introduce wikimedia/qunit ruleset
Change-Id: I3972918c00e69d325c5cb2055d4996a8c07b1034
2018-11-15 23:21:32 +00:00
Bartosz Dziewoński 1421878eee Separate parameter aliases in the description table with spaces
This allows them to wrap over multiple lines if necessary, greatly
improving the result for templates with ridiculous number of aliases,
like <https://en.wikipedia.org/wiki/Template:Cite_book/TemplateData>.

Change-Id: I5826ac31b83e81f89f85e87f9098570b3759ccfb
2018-11-15 23:08:18 +00:00
jenkins-bot 593d23fd36 Merge "Don't store templatedata pageprop on doc-subpage" 2018-10-31 15:21:49 +00:00
Timo Tijhof 73aed63e0a ApiTemplateData: Address non-array count() warning on PHP 7.2
The $data value here comes from TemplateDataBlob which is always
an instance of stdClass. It has no items that make sense to count,
and the object was already being used as $data->params a few lines
higher, which means this count operation would always yield "1",
by proxy of count() effectively seeing the non-array as an array
containing the one non-array item.

Bug: T202087
Change-Id: If725aa8b4229613bf60290eb78654a42497056c8
2018-10-14 03:54:24 +01:00
Timo Tijhof 777ddee3aa ApiTemplateData: Use strict check for $langCode
This is assigned as boolean false or any string value.
The previous code used in implicit boolean cast to differentiate,
but the check is insufficient given that "" and "0" would also
cast to false. It is not the responsibility of this code to filter
those out.

Change-Id: I2cc707432b93703b29c49ac17d737f34119fc400
2018-10-14 03:52:55 +01:00
Timo Tijhof 29162276eb ApiTemplateData: Remove needless count() call
These variables always hold arrays, and to assert an array being
non-empty, boolean evaluation is reliable and suffices.

Change-Id: I5173f9d38ff52807a8025897115823d093052ecf
2018-10-14 03:51:38 +01:00
Umherirrender 8d0a3ea30c Update namespace for MediaWiki\Revision\RevisionRecord
Follow-Up: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
Change-Id: Iae4f59a54a0fb65058ef43f51c5c819646935ac7
2018-10-11 19:56:27 +02:00
Timo Tijhof 326558fc77 Don't store templatedata pageprop on doc-subpage
This resolves two issues:
* Database inefficiency (T52512).
* Doc pages showing on Special:PageWithProp.

It also makes progress on (but doesn't fully resolve) T54448,
by not outputting encouraging accidental use of "/doc" by
displaying descriptions and parameter documentations for them
below the suggestions in VisualEditor.

Bug: T52512
Bug: T54448
Change-Id: I99323d7adc5fc072a85ff1d3595f805f537bbb43
2018-10-09 17:46:21 +00:00
jenkins-bot 49f1201621 Merge "Remove empty Default, Example and Auto value sections of the output table" 2018-09-28 16:08:34 +00:00
Agabi10 348edb68d2 Remove empty Default, Example and Auto value sections of the output table
Bug: T125333
Change-Id: I1f7135cdf22c04aaa31744096900fd7ea65f9a37
2018-09-28 15:24:14 +00:00
Volker E e06b2b1686 Replace deprecated 'advanced' by renamed to 'settings' icon
One more, after my comment in I997bc0f8c7d99f73c1cc6b4ce46f6bcdc1eee410
got happily ignored.

Bug: T190581
Change-Id: I26dc9018693ffd4c5edcda021c8adce52325cdc9
2018-09-12 12:49:10 -07:00
Sam Wilson 79e5347d90 Prevent leading hash from starting param names when guessing
Parameter names can be constructed with parser functions, so
we should not include these as raw parameter names. There
might be more characters to add here.

Bug: T203605
Change-Id: If57a9ed7edf1e881cd121d9a1bcb2e7455c04ec9
2018-09-12 10:04:45 +08:00
jenkins-bot 6d438766c8 Merge "Fix problems with MediaWiki messages and non-displaying icons" 2018-09-09 10:41:50 +00:00
Saint Johann c608d204c1 Fix problems with MediaWiki messages and non-displaying icons
Bug: T160252
Change-Id: I997bc0f8c7d99f73c1cc6b4ce46f6bcdc1eee410
2018-09-03 17:14:16 +02:00
Sam Wilson bc1422b788 Ignore subsequent similarly-named parameters when extracting
When extracting raw parameters from wikitext, ignore those that
only differ from already-found ones by spaces, underscores, or
hyphens.

Bug: T193265
Change-Id: I012e06bf4353eaaf0613124d7d6b88f3444d248a
2018-08-27 11:14:27 +08:00
Sam Wilson f5fece10fd Guess template parameters when templatedata is missing
Deprecate the 'doNotIgnoreMissingTitles' parameter and
replace it with 'includeMissingTitles'. If this parameter
is requested 'raw parameters' will be added to the
response in the same format as templatedata parameters.
Raw parameters are those that *might* be in the
template (using the same logic as the TemplateData generator
wizard).

Also fix the example that was using a falsy value which
meant the option was enabled rather than disabled as it
says in the docs.

Bug: T191756
Change-Id: Ie5fe2097cda45968bb080643d3afcac0b2868a6c
2018-04-25 11:42:18 -07:00
Kunal Mehta de96754626 Move PHP classes to includes/
Change-Id: I7f46b6da2995687b3ec1ed95cf6f35c2a40d4f1e
2018-04-24 16:50:31 -07:00