From c22dc8d95bb3e0d7fdb2e220012c627f03ecc161 Mon Sep 17 00:00:00 2001 From: Jan Drewniak Date: Sat, 1 May 2021 11:09:02 +0200 Subject: [PATCH] Refactor: Renaming mustache variable `page-isarticle` to `is-article` Modifies this variable name to use proper hyphen-case and prioritizes the type of variable rather than it's source. This prioritization makes sense in Mustache templates because the variable is a boolean and is used exclusively in if statements, e.g. {{#is-article}} ... {{/is-article}} Change-Id: I72e9baf0a979d922b8217aabe8cf0c40699f891b --- includes/SkinVector.php | 2 +- includes/templates/skin-legacy.mustache | 4 ++-- includes/templates/skin.mustache | 8 ++++---- stories/skin.stories.data.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 5fe05a2..bf0d79e 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -204,7 +204,7 @@ class SkinVector extends SkinMustache { $commonSkinData = array_merge( $parentData, [ 'consolidate-user-links' => $this->consolidateUserLinks(), - 'page-isarticle' => (bool)$out->isArticle(), + 'is-article' => (bool)$out->isArticle(), 'is-mainpage' => $title->isMainPage(), // Remember that the string '0' is a valid title. diff --git a/includes/templates/skin-legacy.mustache b/includes/templates/skin-legacy.mustache index fff3483..b728674 100644 --- a/includes/templates/skin-legacy.mustache +++ b/includes/templates/skin-legacy.mustache @@ -4,7 +4,7 @@ Indicator[] array-indicators wiki-defined badges such as "good article", "featured article". An empty array if none are defined. string html-title - bool page-isarticle + bool is-article string msg-tagline string html-subtitle string html-undelete-link @@ -33,7 +33,7 @@ {{>Indicators}}

{{{html-title}}}

- {{#page-isarticle}}
{{msg-tagline}}
{{/page-isarticle}} + {{#is-article}}
{{msg-tagline}}
{{/is-article}}
{{{html-subtitle}}}
{{{html-undelete-link}}}
{{{html-user-message}}} diff --git a/includes/templates/skin.mustache b/includes/templates/skin.mustache index 6299bc6..2550e9c 100644 --- a/includes/templates/skin.mustache +++ b/includes/templates/skin.mustache @@ -4,7 +4,7 @@ Indicator[] array-indicators wiki-defined badges such as "good article", "featured article". An empty array if none are defined. string html-title - bool page-isarticle + bool is-article string msg-tagline string html-subtitle string html-undelete-link @@ -64,15 +64,15 @@ {{{html-title}}} {{>Indicators}} - {{#page-isarticle}} + {{#is-article}}
{{msg-tagline}}
- {{/page-isarticle}} + {{/is-article}} {{/is-language-in-header}}
{{^is-language-in-header}} - {{#page-isarticle}}
{{msg-tagline}}
{{/page-isarticle}} + {{#is-article}}
{{msg-tagline}}
{{/is-article}} {{/is-language-in-header}}
{{{html-subtitle}}}
{{{html-undelete-link}}}
diff --git a/stories/skin.stories.data.js b/stories/skin.stories.data.js index 10c90d6..e2e81ea 100644 --- a/stories/skin.stories.data.js +++ b/stories/skin.stories.data.js @@ -89,7 +89,7 @@ const DATA_INDICATORS = [ { export const LEGACY_TEMPLATE_DATA = { 'html-title': 'Vector 2019', - 'page-isarticle': true, + 'is-article': true, 'msg-tagline': 'From Wikipedia, the free encyclopedia', 'html-user-language-attributes': htmlUserLanguageAttributes, 'msg-vector-jumptonavigation': 'Jump to navigation',