This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

97
book/node_modules/highlight.js/es/languages/leaf.js generated vendored Normal file
View File

@ -0,0 +1,97 @@
/*
Language: Leaf
Description: A Swift-based templating language created for the Vapor project.
Website: https://docs.vapor.codes/leaf/overview
Category: template
*/
function leaf(hljs) {
const IDENT = /([A-Za-z_][A-Za-z_0-9]*)?/;
const LITERALS = [
'true',
'false',
'in'
];
const PARAMS = {
scope: 'params',
begin: /\(/,
end: /\)(?=\:?)/,
endsParent: true,
relevance: 7,
contains: [
{
scope: 'string',
begin: '"',
end: '"'
},
{
scope: 'keyword',
match: LITERALS.join("|"),
},
{
scope: 'variable',
match: /[A-Za-z_][A-Za-z_0-9]*/
},
{
scope: 'operator',
match: /\+|\-|\*|\/|\%|\=\=|\=|\!|\>|\<|\&\&|\|\|/
}
]
};
const INSIDE_DISPATCH = {
match: [
IDENT,
/(?=\()/,
],
scope: {
1: "keyword"
},
contains: [ PARAMS ]
};
PARAMS.contains.unshift(INSIDE_DISPATCH);
return {
name: 'Leaf',
contains: [
// #ident():
{
match: [
/#+/,
IDENT,
/(?=\()/,
],
scope: {
1: "punctuation",
2: "keyword"
},
// will start up after the ending `)` match from line ~44
// just to grab the trailing `:` if we can match it
starts: {
contains: [
{
match: /\:/,
scope: "punctuation"
}
]
},
contains: [
PARAMS
],
},
// #ident or #ident:
{
match: [
/#+/,
IDENT,
/:?/,
],
scope: {
1: "punctuation",
2: "keyword",
3: "punctuation"
}
},
]
};
}
export { leaf as default };