Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HAML templates #18

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Vue Component.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ contexts:
- include: template-lang-decider

template-lang-decider:
- match: (?i)(?=haml{{unquoted_attribute_break}}|\'haml\'|"haml")
set:
- template-haml
- tag-lang-attribute-meta
- tag-generic-attribute-value
- match: (?i)(?=jade{{unquoted_attribute_break}}|\'jade\'|"jade")
set:
- template-jade
Expand All @@ -648,6 +653,20 @@ contexts:
- tag-lang-attribute-meta
- tag-generic-attribute-value

template-haml:
- meta_scope: meta.tag.template.begin.html
- match: '>'
scope: punctuation.definition.tag.end.html
set: template-haml-content
- include: template-common

template-haml-content:
- match: '{{template_content_begin}}'
embed: scope:text.haml
embed_scope: text.haml.embedded.html
escape: '{{template_content_end}}'
pop: 1

template-jade:
- meta_scope: meta.tag.template.begin.html
- match: '>'
Expand Down
34 changes: 33 additions & 1 deletion tests/syntax_test_template.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@
// <- text.html.vue - text text
// ^^^^^^^^^^^ meta.tag.template.end.html

<!--
HAML Template Tests
-->

<template lang="haml">
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
// ^^^^^^^^^^^ meta.tag meta.attribute-with-value.lang.html - meta.tag meta.tag
// ^ meta.tag.template.begin.html - meta.tag meta.tag
// ^ punctuation.definition.tag.begin.html
// ^^^^^^^^ entity.name.tag.template.html
// ^^^^ entity.other.attribute-name.html
// ^ punctuation.separator.key-value.html
// ^ punctuation.definition.tag.end.html

// <- text.haml.embedded.html
</template>
// ^^^^^^^^^^^ meta.tag - meta.tag meta.tag - text.haml
// ^^ punctuation.definition.tag.begin.html
// ^^^^^^^^ entity.name.tag.template.html
// ^ punctuation.definition.tag.end.html

<!--
Jade Template Tests
-->

<template lang="jade"> foo </template>
// ^^^^^^^^^^^^^^^^^^^^^^ meta.tag - source
// ^^^^^ text.jade.embedded.html - meta.tag
Expand All @@ -32,7 +57,6 @@
// ^^^^^^^^^^^^^^ text.jade.embedded.html - meta.tag - comment
// ^^^^^^^^^^^ meta.tag - source


<template lang="jade">

// <- text.jade.embedded.html
Expand All @@ -58,6 +82,10 @@
// ^^^^^^^^ entity.name.tag.template.html
// ^ punctuation.definition.tag.end.html

<!--
Pug Template Tests
-->

<template lang="pug">
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
// ^^^^^^^^^^ meta.tag meta.attribute-with-value.lang.html - meta.tag meta.tag
Expand All @@ -75,6 +103,10 @@
// ^^^^^^^^ entity.name.tag.template.html
// ^ punctuation.definition.tag.end.html

<!--
Slim Template Tests
-->

<template lang="slm">
// ^^^^^^^^^^ meta.tag - meta.tag meta.tag - meta.attribute-with-value
// ^^^^^^^^^^ meta.tag meta.attribute-with-value.lang.html - meta.tag meta.tag
Expand Down