From 406012f8630ca8abf40d48aeb0276b66e691f606 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 6 Mar 2020 22:53:04 +0000 Subject: [PATCH] docs: Improve VectorTemplate Mustache param docs Separate value type from value groups, to clarify that e.g. something coming from a hook does not mean it should not have "html-". Change-Id: I52fdd6995241e1d64f23fd8154997de813f674f4 --- includes/VectorTemplate.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/includes/VectorTemplate.php b/includes/VectorTemplate.php index d6beaa4..6e43a91 100644 --- a/includes/VectorTemplate.php +++ b/includes/VectorTemplate.php @@ -93,18 +93,22 @@ class VectorTemplate extends BaseTemplate { ob_end_clean(); $tp = $this->getTemplateParser(); - // Naming conventions for Mustache parameters: + // Naming conventions for Mustache parameters. + // + // Value type (first segment): // - Prefix "is" for boolean values. - // - Prefix "msg-" for interface messages. - // - Prefix "page-" for data relating to the current page (e.g. Title, WikiPage, or OutputPage). - // - Prefix "hook-" for any thing generated from a hook. - // It should be followed by the name of the hook in hyphenated lowercase. - // - Prefix "html-" for raw HTML (in front of other keys excluding `array-`, if applicable). - // Should be avoided where possible. - // - Prefix "array-" for anything that is iterable (in front of other keys is applicable) - // - Prefix "data-" for an object of template data that can be passed directly + // - Prefix "msg-" for interface message text. + // - Prefix "html-" for raw HTML. + // - Prefix "data-" for an array of template parameters that should be passed directly // to a template partial. - // - Conditional values are null if absent. + // - Prefix "array-" for lists of any values. + // + // Source of value (first or second segment) + // - Segment "page-" for data relating to the current page (e.g. Title, WikiPage, or OutputPage). + // - Segment "hook-" for any thing generated from a hook. + // It should be followed by the name of the hook in hyphenated lowercase. + // + // Conditionally used values must use null to indicate absence (not false or ''). $params = [ 'html-headelement' => $this->get( 'headelement', '' ), 'html-sitenotice' => $this->get( 'sitenotice', null ),