Prism.languages.liquid = {
comment: {
pattern: /(^\{%\s*comment\s*%\})[\s\S]+(?=\{%\s*endcomment\s*%\}$)/,
lookbehind: true,
},
delimiter: {
pattern: /^\{(?:\{\{|[%\{])-?|-?(?:\}\}|[%\}])\}$/,
alias: 'punctuation',
},
string: {
pattern: /"[^"]*"|'[^']*'/,
greedy: true,
},
keyword:
/\b(?:as|assign|break|(?:end)?(?:capture|case|comment|for|form|if|paginate|raw|style|tablerow|unless)|continue|cycle|decrement|echo|else|elsif|in|include|increment|limit|liquid|offset|range|render|reversed|section|when|with)\b/,
object:
/\b(?:address|all_country_option_tags|article|block|blog|cart|checkout|collection|color|country|country_option_tags|currency|current_page|current_tags|customer|customer_address|date|discount_allocation|discount_application|external_video|filter|filter_value|font|forloop|fulfillment|generic_file|gift_card|group|handle|image|line_item|link|linklist|localization|location|measurement|media|metafield|model|model_source|order|page|page_description|page_image|page_title|part|policy|product|product_option|recommendations|request|robots|routes|rule|script|search|selling_plan|selling_plan_allocation|selling_plan_group|shipping_method|shop|shop_locale|sitemap|store_availability|tax_line|template|theme|transaction|unit_price_measurement|user_agent|variant|video|video_source)\b/,
function: [
{
pattern: /(\|\s*)\w+/,
lookbehind: true,
alias: 'filter',
},
{
// array functions
pattern: /(\.\s*)(?:first|last|size)/,
lookbehind: true,
},
],
boolean: /\b(?:false|nil|true)\b/,
range: {
pattern: /\.\./,
alias: 'operator',
},
// https://github.com/Shopify/liquid/blob/698f5e0d967423e013f6169d9111bd969bd78337/lib/liquid/lexer.rb#L21
number: /\b\d+(?:\.\d+)?\b/,
operator: /[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|contains(?=\s)|or)\b/,
punctuation: /[.,\[\]()]/,
empty: {
pattern: /\bempty\b/,
alias: 'keyword',
},
};
Prism.hooks.add('before-tokenize', function (env) {
var liquidPattern =
/\{%\s*comment\s*%\}[\s\S]*?\{%\s*endcomment\s*%\}|\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g;
var insideRaw = false;
Prism.languages['markup-templating'].buildPlaceholders(
env,
'liquid',
liquidPattern,
function (match) {
var tagMatch = /^\{%-?\s*(\w+)/.exec(match);
if (tagMatch) {
var tag = tagMatch[1];
if (tag === 'raw' && !insideRaw) {
insideRaw = true;
return true;
} else if (tag === 'endraw') {
insideRaw = false;
return true;
}
}
return !insideRaw;
}
);
});
Prism.hooks.add('after-tokenize', function (env) {
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'liquid');
});
a>/public/prism/prism-autoit.min.js
blob: 2456b4dd3a614e617c8a3078c4806d420e1297a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
Prism.languages.autoit = {
comment: [
/;.*/,
{
pattern:
/(^[\t ]*)#(?:comments-start|cs)[\s\S]*?^[ \t]*#(?:ce|comments-end)/m,
lookbehind: !0,
},
],
url: {
pattern: /(^[\t ]*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m,
lookbehind: !0,
},
string: {
pattern: /(["'])(?:\1\1|(?!\1)[^\r\n])*\1/,
greedy: !0,
inside: { variable: /([%$@])\w+\1/ },
},
directive: { pattern: /(^[\t ]*)#\w+/m, lookbehind: !0, alias: 'keyword' },
function: /\b\w+(?=\()/,
variable: /[$@]\w+/,
keyword:
/\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,
number: /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,
boolean: /\b(?:False|True)\b/i,
operator: /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Not|Or)\b/i,
punctuation: /[\[\]().,:]/,
};
|