mirror of
https://github.com/Hopiu/tree-sitter-htmldjango.git
synced 2026-03-16 22:00:25 +00:00
Fix variables containing multiple words
This commit is contained in:
parent
0ace5e3b02
commit
b2dba02edd
4 changed files with 7667 additions and 7684 deletions
|
|
@ -38,8 +38,8 @@ module.exports = grammar({
|
|||
_expression: $ => seq("{{", optional($._ws), $.variable, optional($._ws), "}}"),
|
||||
|
||||
variable: $ => seq($.variable_name, repeat(seq("|", $.filter))),
|
||||
// Django variables cannot start with an "_", can contain one or two words separated by a "."
|
||||
variable_name: $ => seq(repeat1(/[A-Za-z]/), optional($._word), optional(seq(".", $._word))),
|
||||
// Django variables cannot start with an "_", can contain one or more words separated by a "."
|
||||
variable_name: $ => seq(repeat1(/[A-Za-z]/), optional($._word), repeat(seq(".", $._word))),
|
||||
|
||||
filter: $ => seq($.filter_name, optional(seq(":", choice($.filter_argument, $._quoted_filter_argument)))),
|
||||
filter_name: $ => $._word,
|
||||
|
|
|
|||
|
|
@ -325,25 +325,20 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "."
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_word"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "."
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_word"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
15311
src/parser.c
15311
src/parser.c
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,7 @@ variable
|
|||
|
||||
<html>
|
||||
{{ variable }}
|
||||
{{ variable.item1.item2 }}
|
||||
{{ variable|filter }}
|
||||
{{ variable|filter:argument }}
|
||||
{{ variable|filter:argument.item1.item2 }}
|
||||
|
|
@ -16,6 +17,8 @@ variable
|
|||
|
||||
(template
|
||||
(content)
|
||||
(variable
|
||||
(variable_name))
|
||||
(variable
|
||||
(variable_name))
|
||||
(variable
|
||||
|
|
|
|||
Loading…
Reference in a new issue