├── Antlers.YAML-tmLanguage ├── Antlers.tmLanguage └── readme.md /Antlers.YAML-tmLanguage: -------------------------------------------------------------------------------- 1 | name: 'Antlers (Statamic Syntax)' 2 | scopeName: text.html.statamic 3 | fileTypes: 4 | - html 5 | - htm 6 | - xhtml 7 | uuid: c312fb5f-f2c9-41a2-9ce1-1b6dc65cc1b3 8 | patterns: 9 | - 10 | include: '#statamic-comments' 11 | - 12 | include: '#statamic-overall-tags' 13 | - 14 | comment: 'This is set to use XHTML standards, but you can change that by changing .strict to .basic for HTML standards' 15 | include: text.html.basic 16 | repository: 17 | statamic-comments: 18 | begin: '\{\{\#' 19 | end: '\#\}\}' 20 | name: comment.block.statamic 21 | statamic-overall-tags: 22 | begin: '\{\{(\s?)' 23 | end: '(\s?)\}\}' 24 | name: punctuation.tag.statamic 25 | patterns: 26 | - { include: '#statamic-overall-tags' } 27 | - { include: '#statamic-tag-addon-builtin' } 28 | - { include: '#statamic-tag-parameter-known' } 29 | - { include: '#statamic-tag-conditional' } 30 | - { include: '#tag-stuff' } 31 | statamic-tag-addon-builtin: 32 | match: '(404|/?asset(:)?|/?assets(:)?|/?cache|/?can:cp:([a-zA-Z0-9-_:]+)|/?collection(:)?([a-zA-Z0-9-_:]+)?|control_panel_edit_url|count|current_date|date_groups|/?email_form|/?entries(:)?(listing|pagination|map|previous|next|meld)?|exists|get:[a-zA-Z0-9-_:]+|/?get_content|/?get_files|get_post:[a-zA-Z0-9-_:]+|get_value:[a-zA-Z0-9-_:]+|glide|/?in:[a-zA-Z0-9-_:]+|/?is:[a-zA-Z0-9-_:]+|/?location(:)?(map_listing|map_url)?|log(:)?(debug|info|warn|error|fatal)?|login|login_form|logout|logout_url|/?member(:)?(forgot_password_form|listing|pagination|profile|profile_form|register_form|reset_password_form)?|/?nav(:)?(exists|count|breadcrumbs)?|/?obfuscate|old:[a-zA-Z0-9-_\-:]+|/?pages(:)?(listing|next|previous|meld)?|path|post:[a-zA-Z0-9-_:]+|/?parent:[a-zA-Z0-9-_:]+|partial:[a-zA-Z0-9-_\-:]+|/?protect:(password_form)|redirect|/?relate:[a-zA-Z0-9-_:]+|/?search:results|switch|/?taxonomy:[a-zA-Z0-9-_:]+|/?taxonomy:listing|theme(:)?([a-zA-Z0-9-_:]+)?|transform|/?user(:)?(can|forgot_password_form|in|is|login_form|logout|logout_url|profile|register_form|reset_password_form)?|/?users|/?var\b(:)?([a-zA-Z0-9-_:]+)?)\b' 33 | name: meta.function-call.statamic 34 | statamic-tag-parameter-known: 35 | match: '(action|add|allow_request_return|ampersand_list|as|ascii|at|attr|backspace|bcc|between|blur|brightness|cache_bust|camelize|cc|cdata|ceil|center_point|class|clusters|collapse|collapse_whitespace|collection|conditions|console_log|contains|contains_all|contains_any|contrast|count|count_substring|crop|current|dashify|days_ago|decode|depth|deslugify|destination|divide|dl|do|dump|email|ends_with|ensure_left|ensure_right|entities|exclude|explode|extension|favicon|field|fields|file_date|file_size|file|filename|filter|first|fit|flatten|flip|floor|folder|folders_only|for|format|format_localized|from|full_urls|gamma|gravatar|greyscale|group|groups|group_by|group_by_date|has_lower_case|has_upper_case|height|honeypot|hours_ago|id|image|in|include_content|include_entries|include_home|insert|is|is_after|is_alpha|is_alphanumeric|is_before|is_between|is_empty|is_future|is_json|is_leap_year|is_lowercase|is_numberwang|is_numeric|is_past|is_today|is_uppercase|is_weekday|is_weekend|is_yesterday|join|key|last|lcfirst|length|limit|link|locate_with|logged_in_redirect|lower|macro|mailto|map_id|markdown|match|max_depth|member|message|min_count|minutes_ago|mod|months_ago|msg_footer|msg_header|multiply|name|nl2br|not_in|obfuscate|obfuscate_email|offset|ol|open_popup|orient|page|paginate|param|partial|permission|pixelate|plural|pos_x|pos_y|precision|quality|ratio|rawurlencode|read_time|redirect|regex_replace|relative|remove_left|remove_right|repeat|replace|required|reset_return|reset_url|response|return|reverse|role|roles|rotate|round|safe_truncate|sanitize|scope|seconds_ago|sentence_list|segment|sharpen|show_future|show_hidden|show_past|show_unpublished|shuffle|singular|since|slugify|smartypants|sort_by|sort_dir|sort|specifically|square|src|starts_with|strip_tags|subject|substr|subtract|sum|surround|swap_case|tag|taxonomy|textile|tidy|title|to|to_json|to_spaces|to_tabs|trim|truncate|type|ucfirst|ul|underscored|unique|until|upper|upsize|url|urldecode|urlencode|use_context|username|version|watermark|weeks_ago|what|widont|width|word_count|wrap|years_ago|zoom)=(?!=)' 36 | name: support.function.parameter.statamic 37 | statamic-tag-native-variable: 38 | match: '(\G|\s|\b)(_is_draft|_is_hidden|_site_name|_site_url|recursive\schildren|alt|basename|/?children|collection|content|count|current_uri|current_url|date|date_group|datestamp|email_sent|environment|error|/?errors|expired|extension|field_errors:[a-zA-Z0-9-_:]+|file|filename|first|get|get_post|grouped_date|has_entries|has_next|has_previous|homepage|id|index|is_[a-zA-Z0-9-_:]+|is_admin|is_current|is_entry|is_image|is_page|is_parent|is_published|is_\[role\]|in_\[group\]|last_modified_instance|last_modified_timestamp|last_modified|last_segment|last|layout_content|locale|logged_in|name|next_page|next|no_results|now|old_values:[a-zA-Z0-9-_:]+|page_url|parent|path|permalink|post|prev|previous_page|previous|response_code|results|search_score|segment_[0-9]+|site_url|size_b|size_bytes|size_gb|size_gigabytes|size_kb|size_kilobytes|size_mb|size_megabytes|size|slug|success|taxonomy_name|taxonomy_slug|theme_path|title|total_found|total_results|url_invalid|url|username|zero_index)\b(?![\=\-\:])' 39 | captures: 40 | '2': { name: variable.language.statamic } 41 | statamic-variable: 42 | match: '(/?\w+)(:)?(\w+)?' 43 | captures: 44 | '1': { name: variable.other.statamic } 45 | '2': { name: keyword.operator.other.statamic } 46 | '3': { name: support.function.statamic } 47 | statamic-var-modifiers: 48 | match: '(\s)?(\|)(\s)?(\w+((:([a-zA-Z0-9-_/-@]+)){1,2})?|((-|\+|\*|/|\^|\%):(\d*)?\.?(\d+)))+' 49 | captures: 50 | '2': { name: keyword.operator.other.statamic } 51 | '4': { name: support.function.statamic } 52 | statamic-tag-conditional: 53 | match: '(/?else|/?elseif|/?if|/?unless|endif|endunless|unlesselse)' 54 | name: keyword.control.statamic 55 | statamic-tag-operator: 56 | match: '(\(|\)|or|OR|and|AND|&&|<=|>=|<>|<|>|=|!=|==|===|!==|~|\|\|)' 57 | name: keyword.operator.logical.statamic 58 | statamic-constant-language: 59 | match: (\G|\s|\b)(true|TRUE|false|FALSE|yes|YES|no|NO)\s 60 | captures: 61 | '2': { name: constant.language.statamic } 62 | statamic-constant-numbers: 63 | match: '(\d*)?\.?(\d+)' 64 | name: constant.numeric.statamic 65 | statamic-modifier-pipe: 66 | match: (\|) 67 | name: keyword.operator.other.statamic 68 | statamic-not-operator: 69 | match: (\s|^)(!) 70 | name: keyword.operator.other.statamic 71 | statamic-string-double-quoted: 72 | begin: '"' 73 | end: '"' 74 | name: string.quoted.double.html 75 | statamic-string-single-quoted: 76 | begin: '''' 77 | end: '''' 78 | name: string.quoted.single.html 79 | tag-stuff: 80 | patterns: 81 | - { include: '#statamic-constant-numbers' } 82 | - { include: '#statamic-constant-language' } 83 | - { include: '#statamic-tag-operator' } 84 | - { include: '#statamic-not-operator' } 85 | - { include: '#statamic-tag-native-variable' } 86 | - { include: '#statamic-variable' } 87 | - { include: '#statamic-var-modifiers' } 88 | - { include: '#statamic-string-double-quoted' } 89 | - { include: '#statamic-string-single-quoted' } 90 | -------------------------------------------------------------------------------- /Antlers.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Antlers (Statamic Syntax) 7 | scopeName 8 | text.html.statamic 9 | fileTypes 10 | 11 | html 12 | htm 13 | xhtml 14 | 15 | uuid 16 | c312fb5f-f2c9-41a2-9ce1-1b6dc65cc1b3 17 | patterns 18 | 19 | 20 | include 21 | #statamic-comments 22 | 23 | 24 | include 25 | #statamic-overall-tags 26 | 27 | 28 | comment 29 | This is set to use XHTML standards, but you can change that by changing .strict to .basic for HTML standards 30 | include 31 | text.html.basic 32 | 33 | 34 | repository 35 | 36 | statamic-comments 37 | 38 | begin 39 | \{\{\# 40 | end 41 | \#\}\} 42 | name 43 | comment.block.statamic 44 | 45 | statamic-overall-tags 46 | 47 | begin 48 | \{\{(\s?) 49 | end 50 | (\s?)\}\} 51 | name 52 | punctuation.tag.statamic 53 | patterns 54 | 55 | 56 | include 57 | #statamic-overall-tags 58 | 59 | 60 | include 61 | #statamic-tag-addon-builtin 62 | 63 | 64 | include 65 | #statamic-tag-parameter-known 66 | 67 | 68 | include 69 | #statamic-tag-conditional 70 | 71 | 72 | include 73 | #tag-stuff 74 | 75 | 76 | 77 | statamic-tag-addon-builtin 78 | 79 | match 80 | (404|/?asset(:)?|/?assets(:)?|/?cache|/?can:cp:([a-zA-Z0-9-_:]+)|/?collection(:)?([a-zA-Z0-9-_:]+)?|control_panel_edit_url|count|current_date|date_groups|/?email_form|/?entries(:)?(listing|pagination|map|previous|next|meld)?|exists|get:[a-zA-Z0-9-_:]+|/?get_content|/?get_files|get_post:[a-zA-Z0-9-_:]+|get_value:[a-zA-Z0-9-_:]+|glide|/?in:[a-zA-Z0-9-_:]+|/?is:[a-zA-Z0-9-_:]+|/?location(:)?(map_listing|map_url)?|log(:)?(debug|info|warn|error|fatal)?|login|login_form|logout|logout_url|/?member(:)?(forgot_password_form|listing|pagination|profile|profile_form|register_form|reset_password_form)?|/?nav(:)?(exists|count|breadcrumbs)?|/?obfuscate|old:[a-zA-Z0-9-_\-:]+|/?pages(:)?(listing|next|previous|meld)?|path|post:[a-zA-Z0-9-_:]+|/?parent:[a-zA-Z0-9-_:]+|partial:[a-zA-Z0-9-_\-:]+|/?protect:(password_form)|redirect|/?relate:[a-zA-Z0-9-_:]+|/?search:results|switch|/?taxonomy:[a-zA-Z0-9-_:]+|/?taxonomy:listing|theme(:)?([a-zA-Z0-9-_:]+)?|transform|/?user(:)?(can|forgot_password_form|in|is|login_form|logout|logout_url|profile|register_form|reset_password_form)?|/?users|/?var\b(:)?([a-zA-Z0-9-_:]+)?)\b 81 | name 82 | meta.function-call.statamic 83 | 84 | statamic-tag-parameter-known 85 | 86 | match 87 | (action|add|allow_request_return|ampersand_list|as|ascii|at|attr|backspace|bcc|between|blur|brightness|cache_bust|camelize|cc|cdata|ceil|center_point|class|clusters|collapse|collapse_whitespace|collection|conditions|console_log|contains|contains_all|contains_any|contrast|count|count_substring|crop|current|dashify|days_ago|decode|depth|deslugify|destination|divide|dl|do|dump|email|ends_with|ensure_left|ensure_right|entities|exclude|explode|extension|favicon|field|fields|file_date|file_size|file|filename|filter|first|fit|flatten|flip|floor|folder|folders_only|for|format|format_localized|from|full_urls|gamma|gravatar|greyscale|group|groups|group_by|group_by_date|has_lower_case|has_upper_case|height|honeypot|hours_ago|id|image|in|include_content|include_entries|include_home|insert|is|is_after|is_alpha|is_alphanumeric|is_before|is_between|is_empty|is_future|is_json|is_leap_year|is_lowercase|is_numberwang|is_numeric|is_past|is_today|is_uppercase|is_weekday|is_weekend|is_yesterday|join|key|last|lcfirst|length|limit|link|locate_with|logged_in_redirect|lower|macro|mailto|map_id|markdown|match|max_depth|member|message|min_count|minutes_ago|mod|months_ago|msg_footer|msg_header|multiply|name|nl2br|not_in|obfuscate|obfuscate_email|offset|ol|open_popup|orient|page|paginate|param|partial|permission|pixelate|plural|pos_x|pos_y|precision|quality|ratio|rawurlencode|read_time|redirect|regex_replace|relative|remove_left|remove_right|repeat|replace|required|reset_return|reset_url|response|return|reverse|role|roles|rotate|round|safe_truncate|sanitize|scope|seconds_ago|sentence_list|segment|sharpen|show_future|show_hidden|show_past|show_unpublished|shuffle|singular|since|slugify|smartypants|sort_by|sort_dir|sort|specifically|square|src|starts_with|strip_tags|subject|substr|subtract|sum|surround|swap_case|tag|taxonomy|textile|tidy|title|to|to_json|to_spaces|to_tabs|trim|truncate|type|ucfirst|ul|underscored|unique|until|upper|upsize|url|urldecode|urlencode|use_context|username|version|watermark|weeks_ago|what|widont|width|word_count|wrap|years_ago|zoom)=(?!=) 88 | name 89 | support.function.parameter.statamic 90 | 91 | statamic-tag-native-variable 92 | 93 | match 94 | (\G|\s|\b)(_is_draft|_is_hidden|_site_name|_site_url|recursive\schildren|alt|basename|/?children|collection|content|count|current_uri|current_url|date|date_group|datestamp|email_sent|environment|error|/?errors|expired|extension|field_errors:[a-zA-Z0-9-_:]+|file|filename|first|get|get_post|grouped_date|has_entries|has_next|has_previous|homepage|id|index|is_[a-zA-Z0-9-_:]+|is_admin|is_current|is_entry|is_image|is_page|is_parent|is_published|is_\[role\]|in_\[group\]|last_modified_instance|last_modified_timestamp|last_modified|last_segment|last|layout_content|locale|logged_in|name|next_page|next|no_results|now|old_values:[a-zA-Z0-9-_:]+|page_url|parent|path|permalink|post|prev|previous_page|previous|response_code|results|search_score|segment_[0-9]+|site_url|size_b|size_bytes|size_gb|size_gigabytes|size_kb|size_kilobytes|size_mb|size_megabytes|size|slug|success|taxonomy_name|taxonomy_slug|theme_path|title|total_found|total_results|url_invalid|url|username|zero_index)\b(?![\=\-\:]) 95 | captures 96 | 97 | 2 98 | 99 | name 100 | variable.language.statamic 101 | 102 | 103 | 104 | statamic-variable 105 | 106 | match 107 | (/?\w+)(:)?(\w+)? 108 | captures 109 | 110 | 1 111 | 112 | name 113 | variable.other.statamic 114 | 115 | 2 116 | 117 | name 118 | keyword.operator.other.statamic 119 | 120 | 3 121 | 122 | name 123 | support.function.statamic 124 | 125 | 126 | 127 | statamic-var-modifiers 128 | 129 | match 130 | (\s)?(\|)(\s)?(\w+((:([a-zA-Z0-9-_/-@]+)){1,2})?|((-|\+|\*|/|\^|\%):(\d*)?\.?(\d+)))+ 131 | captures 132 | 133 | 2 134 | 135 | name 136 | keyword.operator.other.statamic 137 | 138 | 4 139 | 140 | name 141 | support.function.statamic 142 | 143 | 144 | 145 | statamic-tag-conditional 146 | 147 | match 148 | (/?else|/?elseif|/?if|/?unless|endif|endunless|unlesselse) 149 | name 150 | keyword.control.statamic 151 | 152 | statamic-tag-operator 153 | 154 | match 155 | (\(|\)|or|OR|and|AND|&&|<=|>=|<>|<|>|=|!=|==|===|!==|~|\|\|) 156 | name 157 | keyword.operator.logical.statamic 158 | 159 | statamic-constant-language 160 | 161 | match 162 | (\G|\s|\b)(true|TRUE|false|FALSE|yes|YES|no|NO)\s 163 | captures 164 | 165 | 2 166 | 167 | name 168 | constant.language.statamic 169 | 170 | 171 | 172 | statamic-constant-numbers 173 | 174 | match 175 | (\d*)?\.?(\d+) 176 | name 177 | constant.numeric.statamic 178 | 179 | statamic-modifier-pipe 180 | 181 | match 182 | (\|) 183 | name 184 | keyword.operator.other.statamic 185 | 186 | statamic-not-operator 187 | 188 | match 189 | (\s|^)(!) 190 | name 191 | keyword.operator.other.statamic 192 | 193 | statamic-string-double-quoted 194 | 195 | begin 196 | " 197 | end 198 | " 199 | name 200 | string.quoted.double.html 201 | 202 | statamic-string-single-quoted 203 | 204 | begin 205 | ' 206 | end 207 | ' 208 | name 209 | string.quoted.single.html 210 | 211 | tag-stuff 212 | 213 | patterns 214 | 215 | 216 | include 217 | #statamic-constant-numbers 218 | 219 | 220 | include 221 | #statamic-constant-language 222 | 223 | 224 | include 225 | #statamic-tag-operator 226 | 227 | 228 | include 229 | #statamic-not-operator 230 | 231 | 232 | include 233 | #statamic-tag-native-variable 234 | 235 | 236 | include 237 | #statamic-variable 238 | 239 | 240 | include 241 | #statamic-var-modifiers 242 | 243 | 244 | include 245 | #statamic-string-double-quoted 246 | 247 | 248 | include 249 | #statamic-string-single-quoted 250 | 251 | 252 | 253 | 254 | 255 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | "Antlers" Statamic syntax highlighting for Sublime Text 2 | ======================================================= 3 | 4 | This started as a weekend project to bring Statamic tag syntax highlighting to Sublime Text. I pulled a lot of the information for this from this ExpressionEngine bundle: https://github.com/fcgrx/ExpressionEngine2-Sublime-Text-3-Bundle and looking at this documentation: http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html. In all honesty, I still don't understand why much of the syntax works. 5 | 6 | I called this Antlers because it was just fun... I mean, heck... everything about Statamic is fun. 7 | 8 | Updates 9 | ------- 10 | 11 | I'm now doing my best to keep this version up-to-date with the [VS Code](https://github.com/addisonhall/ahdesign.antlers) and [Atom](https://github.com/addisonhall/language-antlers) versions. 12 | 13 | Installation 14 | ------------ 15 | 16 | 1. Click the Downloads button at the top right of this page. 17 | 2. Choose the zip file. 18 | 3. Once downloaded, unzip the the zip file. 19 | 4. If you're looking at a folder, rename it to Antlers. If you're looking at a set of files, create a new folder named Antlers and put the files in. 20 | 5. Copy the folder to the appropriate place (Note that this should work with Sublime Text 2 or 3): 21 | 22 | - OS X: ~/Library/Application Support/Sublime Text 3/Packages/ 23 | - Windows: %APPDATA%/Sublime Text 3/Packages/ 24 | - Linux: ~/.config/sublime-text-3/Packages 25 | 26 | To do 27 | ----- 28 | 29 | I still need to add some stuff for the Raven and Bloodhound add-ons (http://statamic.com/add-ons). Statamic version 2 is on the way, and Raven and Bloodhound are now built-in, so the need for this may change. --------------------------------------------------------------------------------