Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infininight/b03b1354ae402f6170814af88efed26f to your computer and use it in GitHub Desktop.
Save infininight/b03b1354ae402f6170814af88efed26f to your computer and use it in GitHub Desktop.
Sample extension grammar for HTML based template language (This is in bundle editor format, create a new grammar and paste in the contents.)
{ patterns = (
{ name = 'meta.tag.template.start.html';
begin = '(<)(s:[\-.0-9_a-zA-Z]*)(?=\s|/?>)';
end = '/?>';
beginCaptures = {
1 = { name = 'punctuation.definition.tag.begin.html'; };
2 = { name = 'entity.name.tag.html'; };
};
endCaptures = { 0 = { name = 'punctuation.definition.tag.end.html'; }; };
patterns = ( { include = 'text.html.basic#attribute'; } );
},
{ name = 'meta.tag.template.end.html';
begin = '(</)(s:[\-.0-9_a-zA-Z]*)(?=\s|/?>)';
end = '>';
beginCaptures = {
1 = { name = 'punctuation.definition.tag.begin.html'; };
2 = { name = 'entity.name.tag.html'; };
};
endCaptures = { 0 = { name = 'punctuation.definition.tag.end.html'; }; };
patterns = ( { include = 'text.html.basic#attribute'; } );
},
{ name = 'meta.embedded.line.scala-template';
begin = '\$\{';
end = '(\})';
beginCaptures = { 0 = { name = 'punctuation.section.embedded.begin.scala-template'; }; };
endCaptures = {
0 = { name = 'punctuation.section.embedded.end.scala-template'; };
1 = { name = 'source.scala-template'; };
};
contentName = 'source.scala';
patterns = (
{ name = 'variable.other.readwrite.scala-template';
match = 'foobar';
},
);
},
{ include = 'text.html.basic'; },
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment