Skip to content

Commit

Permalink
Merge pull request #18 from SublimeText/feat/haml-templates
Browse files Browse the repository at this point in the history
Add support for HAML templates
  • Loading branch information
deathaxe authored Nov 21, 2024
2 parents 4dded2e + 8c04194 commit 02aec5a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Vue Component.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,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 @@ -529,6 +534,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

0 comments on commit 02aec5a

Please sign in to comment.