]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/twig.js
1 /*! `twig` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
9 Author: Luke Holder <lukemh@gmail.com>
10 Description: Twig is a templating language for PHP
11 Website: https://twig.symfony.com
16 const regex
= hljs
.regex
;
17 const FUNCTION_NAMES
= [
55 "template_from_string",
82 "format_args_as_text",
87 "format_file_from_text",
153 "trans_default_domain",
160 TAG_NAMES
= TAG_NAMES
.concat(TAG_NAMES
.map(t
=> `end${t}`));
194 beginKeywords: FUNCTION_NAMES
.join(" "),
195 keywords: { name: FUNCTION_NAMES
},
201 match: /\|(?=[A-Za-z_]+:?)/,
202 beginScope: "punctuation",
206 match: /[A-Za-z_]+:?/,
212 const tagNamed
= (tagnames
, { relevance
}) => {
218 relevance: relevance
|| 2,
219 endScope: 'template-tag',
223 regex
.either(...tagnames
)
236 const CUSTOM_TAG_RE
= /[a-z_]+/;
237 const TAG
= tagNamed(TAG_NAMES
, { relevance: 2 });
238 const CUSTOM_TAG
= tagNamed([ CUSTOM_TAG_RE
], { relevance: 1 });
242 aliases: [ 'craftcms' ],
243 case_insensitive: true,
246 hljs
.COMMENT(/\{#/, /#\}/),
250 className: 'template-variable',
269 hljs
.registerLanguage('twig', hljsGrammar
);