Skip to content

Commit

Permalink
enh(twig) add Symphony keywords to twig (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYamous committed Mar 11, 2022
1 parent 8cea942 commit 3da0e25
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -61,6 +61,7 @@ These changes should be for the better and should not be super noticeable but if

Grammars:

- enh(twig) update keywords list for symfony (#3453) [Matthieu Lempereur][]
- enh(arcade) updated to ArcGIS Arcade version 1.16 [John Foster][]
- enh(php) Left and right-side of double colon [Wojciech Kania][]
- enh(php) add PHP constants [Wojciech Kania][]
Expand Down
46 changes: 44 additions & 2 deletions src/languages/twig.js
Expand Up @@ -10,26 +10,51 @@ Category: template
export default function(hljs) {
const regex = hljs.regex;
const FUNCTION_NAMES = [
"absolute_url",
"asset|0",
"asset_version",
"attribute",
"block",
"constant",
"controller|0",
"country_timezones",
"csrf_token",
"cycle",
"date",
"dump",
"expression",
"form|0",
"form_end",
"form_errors",
"form_help",
"form_label",
"form_rest",
"form_row",
"form_start",
"form_widget",
"html_classes",
"include",
"is_granted",
"logout_path",
"logout_url",
"max",
"min",
"parent",
"path|0",
"random",
"range",
"relative_path",
"render",
"render_esi",
"source",
"template_from_string"
"template_from_string",
"url|0"
];

const FILTERS = [
"abs",
"abbr_class",
"abbr_method",
"batch",
"capitalize",
"column",
Expand All @@ -42,15 +67,23 @@ export default function(hljs) {
"date_modify",
"default",
"escape",
"file_excerpt",
"file_link",
"file_relative",
"filter",
"first",
"format",
"format_args",
"format_args_as_text",
"format_currency",
"format_date",
"format_datetime",
"format_file",
"format_file_from_text",
"format_number",
"format_time",
"html_to_markdown",
"humanize",
"inky_to_html",
"inline_css",
"join",
Expand Down Expand Up @@ -80,10 +113,14 @@ export default function(hljs) {
"striptags",
"timezone_name",
"title",
"trans",
"transchoice",
"trim",
"u|0",
"upper",
"url_encode"
"url_encode",
"yaml_dump",
"yaml_encode"
];

let TAG_NAMES = [
Expand All @@ -98,13 +135,18 @@ export default function(hljs) {
"filter",
"flush",
"for",
"form_theme",
"from",
"if",
"import",
"include",
"macro",
"sandbox",
"set",
"stopwatch",
"trans",
"trans_default_domain",
"transchoice",
"use",
"verbatim",
"with"
Expand Down

0 comments on commit 3da0e25

Please sign in to comment.