Compare commits

...

2 Commits

Author SHA1 Message Date
Spenser Black 0720b0eafa
Switch grammars
This grammar supports conditionals, which is pretty important.
2025-04-29 19:06:31 -04:00
Spenser Black dd23db5211
Inject JS and CSS in Pug
Injects JavaScript into `script` tags and CSS into `style` tags.
2025-04-29 13:18:28 -04:00
2 changed files with 10 additions and 24 deletions

View File

@ -4323,4 +4323,4 @@ indent = { tab-width = 2, unit = " " }
[[grammar]] [[grammar]]
name = "pug" name = "pug"
source = { git = "https://github.com/codepen/tree-sitter-pug", rev = "60a463fd725afd034045496b9018fa4a081469fd" } source = { git = "https://github.com/zealot128/tree-sitter-pug", rev = "13e9195370172c86a8b88184cc358b23b677cc46" }

View File

@ -6,20 +6,7 @@
((doctype_name) @type.enum.variant) ((doctype_name) @type.enum.variant)
) )
; Tags
(tag_name) @constant (tag_name) @constant
(
link_tag
("link" @constant)
)
(
script_tag
("script" @constant)
)
(
style_tag
("style" @constant)
)
; Attributes ; Attributes
(id) @attribute (id) @attribute
@ -29,7 +16,10 @@
(quoted_attribute_value) @string (quoted_attribute_value) @string
; Controls ; Controls
; NOTE: The grammar currently seems to be missing the "if" conditional (
conditional
((keyword) @keyword.control.conditional)
)
( (
case case
((keyword) @keyword.control) ((keyword) @keyword.control)
@ -41,12 +31,10 @@
( (
each each
((keyword) @keyword.control.repeat) ((keyword) @keyword.control.repeat)
((iteration_variable) @variable) )
((keyword) @keyword.operator) (
( else
else ((keyword) @keyword.control.conditional)
((keyword) @keyword.control.conditional)
)
) )
( (
while while
@ -86,13 +74,11 @@
( (
block_append block_append
((keyword) @keyword.directive) ((keyword) @keyword.directive)
((keyword) @keyword.directive)
((block_name) @function.method) ((block_name) @function.method)
) )
( (
block_prepend block_prepend
((keyword) @keyword.directive) ((keyword) @keyword.directive)
((keyword) @keyword.directive)
((block_name) @function.method) ((block_name) @function.method)
) )
@ -107,5 +93,5 @@
; Inline JavaScript ; Inline JavaScript
( (
unbuffered_code unbuffered_code
(("-") @operator) (("-") @special)
) )