GithubHelp home page GithubHelp logo

interdependence / tree-sitter-htmldjango Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 4.0 188 KB

A tree-sitter grammar for the Django template language

License: MIT License

Python 0.09% C++ 0.25% JavaScript 1.49% Rust 0.95% Scheme 0.13% C 97.09%
django grammar htmldjango tree-sitter

tree-sitter-htmldjango's People

Contributors

interdependence avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tree-sitter-htmldjango's Issues

identiers incorrectly parsed as keywords when they start with the same letters

{% 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"

There are some parsing errors

{% 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.