interdependence / tree-sitter-htmldjango Goto Github PK
View Code? Open in Web Editor NEWA tree-sitter grammar for the Django template language
License: MIT License
A tree-sitter grammar for the Django template language
License: MIT License
Using this page https://meimporta.eu/tree-sitter/json2ebnf.html we can get a navigable railroad diagram for tree-sitter grammars like this project.
See also tree-sitter/tree-sitter#2268 .
Cheers !
{% get_foo as foo %}
Correctly parses as:
template [0, 0] - [1, 0]
unpaired_statement [0, 0] - [0, 20]
tag_name [0, 3] - [0, 10]
keyword [0, 11] - [0, 13]
variable [0, 14] - [0, 17]
variable_name [0, 14] - [0, 17]
but if the variable has any keyword in the name is fails:
{% get_foo as randomfoo %}
Which parses as:
template [0, 0] - [1, 0]
unpaired_statement [0, 0] - [0, 26]
tag_name [0, 3] - [0, 10]
keyword [0, 11] - [0, 13]
keyword [0, 14] - [0, 20] <- "random" keyword
ERROR [0, 20] - [0, 23] <- "foo"
{% extends 'layout.html' %} {% block nav %} <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"> <a href="/">Dashboard</a> </li> <li class="breadcrumb-item"> <a href="{{ request.headers.get('Referer', '/resources/list') }}">Resource management</a> </li> <li class="breadcrumb-item active">Pick</li> </ol> </div> {% endblock %} {% block content %} <div class="container"> <div class="card card-default"> <div class="card-header"> <h3 class="card-title">Attachments</h3> </div> <form method="POST"> <input type="hidden" value="{{ request.headers.get('Referer', '/resources/list') }}" name="returnurl" /> <div class="card-body"> <div class="form-group"> {% for m in meta.get('attachments', []) %} <div class="form-check my-2"> <input class="form-check-input" type="checkbox" name="attachment" value="{{ m.name }}" {{'checked' if m.get('picked', False) }} id="attach_{{ loop.index }}"> <label class="form-check-label" for="attach_{{ loop.index }}">{{ m.name }}</label> </div> {% endfor %} </div> <div class="form-group"> <label for="spiders">Spider</label> <select name="spider" class="form-control" id="spiders"> <option>CGTrader</option> </select> </div> <div class="form-group text-capitalize"> <label for="spiders">3D Model formats</label> <div class="form-text text-muted"> {% for m in meta.get('formats', []) %} <div class="my-1"> Software: {{m.get('software', '')}} Version: {{m.get('version', '')}} Renderer: {{m.get('renderer', '')}} </div> {% endfor %} </div> </div> </div> <div class="card-footer d-flex justify-content-start align-items-center"> <button type="submit" class="btn btn-primary text-uppercase" id="btn_add_to_download">Append to queue</button> <div class="form-check ml-5"> <input class="form-check-input" type="checkbox" name="is_need_image" id="always_download_image" value="true" checked /> <label class="form-check-label" for="always_download_image">Always download preview images</label> </div> </div> </form> </div> <div class="card card-default"> <div class="card-header"> <h3 class="card-title"> Basic information <small>- {{ item.get('name', '') }}</small> </h3> <a class="float-right" href='{{ item.get("source_url", "javascript:;") }}' target="_blank"> <i class="fas fa-external-link-alt"></i> </a> </div> <div class="card-body row"> <div class="col-7 text-center d-flex align-items-center justify-content-center"> <img class="img-thumbnail rounded" src='/static/data/images/{{ meta.get("preview") }}' /> </div> <div class="col-5"> <div class="form-group row my-0"> <label class="col-sm-3 col-form-label font-weight-normal">Publish date</label> <div class="col-sm-3 col-form-label text-muted">{{ item.get('publish_date') }}</div> <label class="col-sm-3 col-form-label font-weight-normal">Model ID</label> <div class="col-sm-3 col-form-label text-muted">{{ item.get('source_id') }}</div> <label class="col-sm-3 col-form-label font-weight-normal">Animated</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('animated') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">Rigged</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('rigged') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">VR</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('is_vr') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">AR</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('is_ar') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">PBR</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('is_pbr') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">Geometry</label> <div class="col-sm-3 col-form-label text-muted">{{ meta.get('geometry', '') }}</div> <label class="col-sm-3 col-form-label font-weight-normal">Polygons</label> <div class="col-sm-3 col-form-label text-muted">{{ meta.get('polygons', '') }}</div> <label class="col-sm-3 col-form-label font-weight-normal">Vertices</label> <div class="col-sm-3 col-form-label text-muted">{{ meta.get('vertices', '') }}</div> <label class="col-sm-3 col-form-label font-weight-normal">Textures</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('textures') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">Materials</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('materials') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">UV Mapping</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('uv_mapping') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">Plugins used</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('plugins_used') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> <label class="col-sm-3 col-form-label font-weight-normal">Unwrapped UVs</label> <div class="col-sm-3 col-form-label text-muted"> {% if meta.get('unwarpped_uvs') == 'true' %} <i class="fas fa-check-circle text-success"></i> {% else %} <i class="far fa-times-circle text-danger"></i> {% endif %} </div> </div> </div> <div class="col-12">{{ item.get('memo', '') }}</div> </div> </div> </div> {% endblock %} {% block script %}<script src="/static/pages/resources/prepare.js"></script>{% endblock %}
Hi,hero. see this code, It looks like the syntax is not parsed correctly, but I don't know what the cause of the problem is
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.