From 9a75b9d4b1dcec7fbdacb58953ebc9a1808cbb6b Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Wed, 13 May 2020 12:59:13 -0400 Subject: [PATCH] (chore) linter --- src/languages/handlebars.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/languages/handlebars.js b/src/languages/handlebars.js index d5dbc918ee..a320df9cd0 100644 --- a/src/languages/handlebars.js +++ b/src/languages/handlebars.js @@ -7,8 +7,7 @@ Website: https://handlebarsjs.com Category: template */ -export default function (hljs) { - +export default function(hljs) { const BUILT_INS = { 'builtin-name': [ 'action', @@ -44,7 +43,7 @@ export default function (hljs) { }; const LITERALS = { - 'literal': [ + literal: [ 'true', 'false', 'undefined', @@ -71,7 +70,8 @@ export default function (hljs) { const SUB_EXPRESSION = { illegal: /\}\}/, - begin: /\(/, end: /\)/ + begin: /\(/, + end: /\)/ // the "contains" is added below when all necessary sub-modes are defined }; @@ -108,7 +108,7 @@ export default function (hljs) { keywords: '' } ] - } + }; const HELPER_PARAMETERS = { contains: [ @@ -151,7 +151,6 @@ export default function (hljs) { className: 'name' }); - const BASIC_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, { className: 'name', keywords: BUILT_INS, @@ -176,20 +175,23 @@ export default function (hljs) { { // open raw block "{{{{raw}}}} content not evaluated {{{{/raw}}}}" className: 'template-tag', - begin: /\{\{\{\{(?!\/)/, end: /\}\}\}\}/, + begin: /\{\{\{\{(?!\/)/, + end: /\}\}\}\}/, contains: [OPENING_BLOCK_MUSTACHE_CONTENTS], starts: {end: /\{\{\{\{\//, returnEnd: true, subLanguage: 'xml'} }, { // close raw block className: 'template-tag', - begin: /\{\{\{\{\//, end: /\}\}\}\}/, + begin: /\{\{\{\{\//, + end: /\}\}\}\}/, contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS] }, { // open block statement className: 'template-tag', - begin: /\{\{#/, end: /\}\}/, + begin: /\{\{#/, + end: /\}\}/, contains: [OPENING_BLOCK_MUSTACHE_CONTENTS], }, { @@ -201,19 +203,22 @@ export default function (hljs) { { // closing block statement className: 'template-tag', - begin: /\{\{\//, end: /\}\}/, + begin: /\{\{\//, + end: /\}\}/, contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS], }, { // template variable or helper-call that is NOT html-escaped className: 'template-variable', - begin: /\{\{\{/, end: /\}\}\}/, + begin: /\{\{\{/, + end: /\}\}\}/, contains: [BASIC_MUSTACHE_CONTENTS] }, { // template variable or helper-call that is html-escaped className: 'template-variable', - begin: /\{\{/, end: /\}\}/, + begin: /\{\{/, + end: /\}\}/, contains: [BASIC_MUSTACHE_CONTENTS] } ]