Skip to content

Commit

Permalink
(chore) linter
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel authored and nknapp committed May 16, 2020
1 parent cdbd6fd commit 88f76a0
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/languages/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Website: https://handlebarsjs.com
Category: template
*/

export default function (hljs) {

export default function(hljs) {
const BUILT_INS = {
'builtin-name': [
'action',
Expand Down Expand Up @@ -44,7 +43,7 @@ export default function (hljs) {
};

const LITERALS = {
'literal': [
literal: [
'true',
'false',
'undefined',
Expand All @@ -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
};

Expand Down Expand Up @@ -108,7 +108,7 @@ export default function (hljs) {
keywords: ''
}
]
}
};

const HELPER_PARAMETERS = {
contains: [
Expand Down Expand Up @@ -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,
Expand All @@ -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],
},
{
Expand All @@ -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]
}
]
Expand Down

0 comments on commit 88f76a0

Please sign in to comment.