prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
41 lines (40 loc) • 1.17 kB
JavaScript
import { l as languages, a as tokenize } from "../../index-DF54SWhA.js";
import { e as embeddedIn } from "../../templating-BdWShxVo.js";
import "./markup.js";
languages.twig = {
"twig": {
pattern: /\{(?:#[^]*?#|%[^]*?%|\{[^]*?\})\}/,
alias: "language-twig",
inside: {
"comment": /^\{#[^]+/,
"tag-name": {
pattern: /(^\{%-?\s*)\w+/,
lookbehind: true,
alias: "keyword"
},
"delimiter": {
pattern: /^..-?|-?[%}]\}$/g,
alias: "punctuation"
},
"string": {
pattern: /(["'])(?:\\.|(?!\1)[^\\\n])*\1/,
inside: {
"punctuation": /^.|["']$/g
}
},
"keyword": /\b(?:even|if|odd)\b/,
"boolean": /\b(?:false|true|null)\b/,
"number": /\b0x[a-fA-F\d]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
"operator": [
{
pattern: /(\s)(?:and|b-and|b-x?or|ends with|in|is|matches|not|or|same as|starts with)(?!\S)/,
lookbehind: true
},
/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[~%|+-]/
],
"punctuation": /[()[\]{}.,:]/
}
},
[tokenize]: embeddedIn("html")
};
//# sourceMappingURL=twig.js.map