proof read readme
This commit is contained in:
1 parent
53e1ee2036
commit
2800449499
1 file changed
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
# tree-sitter-django
|
# tree-sitter-django
|
||||||
|
|
||||||
A [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for the Django Template Language (DTL) — the `{% %}` tags, `{{ }}` variables and `{# #}` comments used in Django templates.
|
A [tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for the [Django Template Language (DTL)](https://docs.djangoproject.com/en/6.1/ref/templates/language/#the-django-template-language) — the `{% %}` tags, `{{ }}` variables and `{# #}` comments used in Django templates.
|
||||||
|
|
||||||
## Coverage
|
## Coverage
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ export default grammar(django, {
|
|||||||
),
|
),
|
||||||
loop_block: ($) => seq($.loop_tag, optional($.template)),
|
loop_block: ($) => seq($.loop_tag, optional($.template)),
|
||||||
endloop_tag: ($) =>
|
endloop_tag: ($) =>
|
||||||
seq($.endTagOpen, field("tag", "endloop"), $.endTagClose),
|
seq($.endTagOpen, field("tag_name", "endloop"), $.endTagClose),
|
||||||
loop_group: ($) =>
|
loop_group: ($) =>
|
||||||
seq(
|
seq(
|
||||||
$.loop_block,
|
$.loop_block,
|
||||||
@@ -229,7 +229,7 @@ export default grammar(django, {
|
|||||||
filter: ($, previous) =>
|
filter: ($, previous) =>
|
||||||
choice(
|
choice(
|
||||||
previous,
|
previous,
|
||||||
seq(field("name", "shout"), ":", field("argument", $.value)),
|
seq(field("filter_name", "shout"), ":", field("argument", $.value)),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -307,10 +307,10 @@ carry on as before.
|
|||||||
|
|
||||||
## Divergences from Django
|
## Divergences from Django
|
||||||
|
|
||||||
The grammar aims to accept what Django accepts, with one deliberate exception. Where Django takes an
|
The grammar aims to accept what Django accepts, with one deliberate exception: where Django takes an
|
||||||
input without complaint but the input is almost certainly a mistake — it parses, and then silently
|
input without complaint but the input is almost certainly a mistake. It reads the mistake and silently
|
||||||
renders nothing or quietly ignores half of what was written — the grammar reports an error instead.
|
renders nothing or quietly ignores half of what was written. This grammar tries to report such mistakes
|
||||||
Every case below is input Django itself accepts:
|
as errors instead. Every case below is input Django itself accepts:
|
||||||
|
|
||||||
- **Number-shaped names.** Django has no number token: a word is a literal if `int()` or `float()` parses
|
- **Number-shaped names.** Django has no number token: a word is a literal if `int()` or `float()` parses
|
||||||
it and a variable lookup otherwise, so `0x1f`, `1a`, `1.`, `1.2.3` and `1__0` look up a variable of that
|
it and a variable lookup otherwise, so `0x1f`, `1a`, `1.`, `1.2.3` and `1__0` look up a variable of that
|
||||||
|
|||||||
Reference in new issue
Block a user