From caa793756973562f1a4b358103c9ce9df7e75389 Mon Sep 17 00:00:00 2001 From: David Carr Date: Sat, 18 Feb 2017 14:13:08 +0000 Subject: [PATCH] initial commit --- Comments.tmPreferences | 42 +++++++++++++++ README.md | 13 ++++- packages.json | 12 +++++ tpl.sublime-syntax | 117 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 2 deletions(-) create mode 100755 Comments.tmPreferences create mode 100755 packages.json create mode 100755 tpl.sublime-syntax diff --git a/Comments.tmPreferences b/Comments.tmPreferences new file mode 100755 index 0000000..045efb8 --- /dev/null +++ b/Comments.tmPreferences @@ -0,0 +1,42 @@ + + + + + name + Comments + scope + text.html.tpl, source.tpl, custom.compiler.tpl + settings + + shellVariables + + + name + TM_COMMENT_START + value + {{-- + + + name + TM_COMMENT_END + value + --}} + + + name + TM_COMMENT_START_2 + value + <!-- + + + name + TM_COMMENT_END_2 + value + --> + + + + uuid + 157b8800-b2cb-11e4-ab27-0800200c9a66 + + diff --git a/README.md b/README.md index 399c4bf..39170dc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ -# template-highlighter -Nova tpl & 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. diff --git a/packages.json b/packages.json new file mode 100755 index 0000000..3dc291a --- /dev/null +++ b/packages.json @@ -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"], + } + ] +} diff --git a/tpl.sublime-syntax b/tpl.sublime-syntax new file mode 100755 index 0000000..eeebab2 --- /dev/null +++ b/tpl.sublime-syntax @@ -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