Skip to content

Conversation

@parisk
Copy link
Contributor

@parisk parisk commented Apr 11, 2015

This pull request improves radically the Django mode by introducing more features and fixing some bugs.

In detail, this pull request introduces the following

  • Comment highlighting (both with inline tag and block comment tag)
  • String highlighting
  • Variable and variable attribute highlighting
  • Operator highlighting
  • Highlighting for filters
  • Definition of blockCommentStart and blockCommentEnd
  • Appropriate highlighting according to tag type: (variable, tag, comment)

This pull request also fixes two major bugs that made highlighting break:

  • Including keywords inside strings highlighted them as keywords instead of string
  • Mixing Django template highlighting with HTML highlighting in the same line broke the HTML highlighting

The only oddball in this pull request is the "null" token styling. Since the django mode is an overlay of django:inner over html, when using Django templates in HTML tag attributes, returning null results in string styling (because of the HTML tag attribute), instead of no styling. For this reason I returned "null" to avoid this.

The Django template language is described extensively at https://docs.djangoproject.com/en/1.8/ref/templates/language

This pull request can be tested at https://codemirror-paris.apps.lair.io/mode/django/index.html

@marijnh
Copy link
Member

marijnh commented Apr 13, 2015

Looks great! Merged as e22891b

@marijnh marijnh closed this Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants