Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
daveismynamecom committed Feb 18, 2017
1 parent ae32160 commit caa7937
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 2 deletions.
42 changes: 42 additions & 0 deletions Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>text.html.tpl, source.tpl, custom.compiler.tpl</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>{{-- </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END</string>
<key>value</key>
<string> --}}</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>&lt;!-- </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string> --&gt;</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>157b8800-b2cb-11e4-ab27-0800200c9a66</string>
</dict>
</plist>
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# template-highlighter
Nova tpl &amp; ntp highlighter for Sublime Text
# Template Highlighter for Sublime Text

This package adds highlighting support for tpl view files for Nova Framework in Sublime Text.

## Install manaually
Clone this repo and place the directory in your Sublime Text Packages folder and restart Sublime Text.

If your tpl files are not identifeid as Nova TPL then click on View -> Syntax -> Open all current extensions as then click on Nova TPL.

## Install via Package Control
Coming soon.
12 changes: 12 additions & 0 deletions packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"schema_version": "1.0.0",
"packages": [
{
"name": "Nova Template Highlighter",
"description": "Nova template syntax highlighter support for Sublime Text.",
"author": "David Carr",
"homepage": "https://github.com/nova-framework/template-highlighter-sublime-text",
"labels": ["php", "nova", "tpl", "language syntax"],
}
]
}
117 changes: 117 additions & 0 deletions tpl.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
%YAML 1.2
---
name: Nova TPL
file_extensions: [.tpl]
scope: .tpl
contexts:
main:
- match: ''
push:
- include: 'scope:text.html.basic'
- meta_scope: text.html.tpl
pop: true
with_prototype:

- match: '{{--'
captures:
0: punctuation.definition.comment.begin.tpl
push:
- meta_scope: comment.block.html.tpl
- match: '--}}'
scope: punctuation.definition.comment.end.tpl
pop: true
- match: "--"
scope: invalid.illegal.bad-comments-or-CDATA.html.tpl

- match: '\{(!!)|(\{\{\{?)-?'
captures:
0: punctuation.section.embedded.begin.tpl
push:
- meta_scope: entity.name.tag.tpl
- meta_content_scope: source.tpl
- match: '-?(\}?\}\})|(!!)\}'
captures:
0: punctuation.section.embedded.end.tpl
1: punctuation.section.embedded.end.tpl
pop: true
- include: 'scope:source.tpl'

- match: '@\{\{\{?-?'
captures:
0: punctuation.section.embedded.ignore.begin.tpl
push:
- meta_scope: 'scope:text.html.basic'
- meta_content_scope: 'scope:text.html.basic'
- match: '-?\}?\}\}'
captures:
0: punctuation.section.embedded.ignore.end.tpl
1: punctuation.section.embedded.ignore.end.tpl
pop: true

- match: '((\s{0}|^)(@)(php)|<\?(?i:php|=)?)(?![^?]*\?>)'
scope: punctuation.section.embedded.begin.php
captures:
0: punctuation.section.embedded.begin.php
3: constant.other.inline-data.html
4: entity.name.tag.block.any.html
push:
- meta_content_scope: source.php
- meta_scope: meta.embedded.block.tpl.php
- include: 'scope:source.php'
with_prototype:
- match: (?=\?>|(\s{0}|^)(@)(endphp))(\?>|(\s{0}|^)(@)(endphp))
captures:
0: punctuation.section.embedded.end.php
6: constant.other.inline-data.html
7: entity.name.tag.block.any.html
pop: true

- match: '<\?(?i:php|=)?'
scope: punctuation.section.embedded.begin.php
push:
- meta_content_scope: source.php.tpl
- meta_scope: meta.embedded.line.tpl.php
- include: 'scope:source.php'
with_prototype:
- match: (?=\?>)(\?>)
captures:
0: punctuation.section.embedded.end.php
pop: true

- match: '(\s{0}|^)(\@)\b(debug|embed|macrodef|set|unset|if|elseif|forelse|foreach|for|while|extends|unless|each|yield|lang|choice|section|include|render|block|can|cannot|inject|partial|hasSection|elsecan|elsecannot|stack|push|layout|continue|break|minify|macro|servers|task|hipchat|slack|story|wpposts|acfrepeater|component|slot)\b(?=(|\s*|)\()'
captures:
0: punctuation.section.embedded.php
2: constant.other.inline-data.html
3: entity.name.tag.block.any.html
push:
- meta_scope: custom.compiler.tpl.php
- meta_content_scope: source.php.tpl
- match: '(?<=\))'
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b(breakpoint|endmacro|endembed|empty|endif|endforelse|endforeach|endfor|endwhile|else|endunless|show|stop|endblock|endpartial|continue|break|endsection|parent|overwrite|endcan|endcannot|append|endpush|markdown|endmarkdown|endminify|endtask|setup|after|endsetup|endafter|endstory|wpquery|wpempty|wpend|acfend|endcomponent|endslot)\b'
scope: custom.compiler.tpl.php
captures:
0: punctuation.section.embedded.php
2: constant.other.inline-data.html
3: entity.name.tag.block.any.html
pop: false

- match: '(\s{0}|^)(\@)\b([a-zA-Z_]+)\b(?=(|\s*|)\()'
captures:
0: support.function
2: constant.other.inline-data.html
push:
- meta_scope: custom.compiler.tpl.php
- meta_content_scope: source.php.tpl
- match: '(?<=\))'
pop: true
- include: 'scope:source.php'

- match: '(\s{0}|^)(\@)\b([a-zA-Z_]+)\b(\s?)\b'
scope: custom.compiler.tpl.php
captures:
0: support.function
2: constant.other.inline-data.html
pop: false

0 comments on commit caa7937

Please sign in to comment.