After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 617136 - Support for Django
Support for Django
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-28 23:05 UTC by Patryk Zawadzki
Modified: 2017-01-30 20:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed enhancement (11.84 KB, application/octet-stream)
2010-04-28 23:05 UTC, Patryk Zawadzki
  Details
add django-template-language (dtl) spec (13.46 KB, patch)
2015-08-20 21:38 UTC, Tobias Schönberg
needs-work Details | Review
dtl.lang: Add Django template language (11.87 KB, patch)
2017-01-02 12:03 UTC, Tobias Schönberg
none Details | Review
dtl.lang: Add Django template language (12.30 KB, patch)
2017-01-03 09:41 UTC, Tobias Schönberg
none Details | Review
dtl.lang: Add Django template language (10.95 KB, patch)
2017-01-21 22:32 UTC, Tobias Schönberg
none Details | Review
dtl.lang: Add Django template language (12.24 KB, patch)
2017-01-28 12:35 UTC, Tobias Schönberg
accepted-commit_now Details | Review

Description Patryk Zawadzki 2010-04-28 23:05:53 UTC
Created attachment 159834 [details]
Proposed enhancement

Attached file adds basic (there is no automatic detection) support for Django/Jinja templates.
Comment 1 Tobias Schönberg 2015-08-06 11:18:09 UTC
Any update on this?

I downloaded the django-template-language file from this page and it really makes editing Django templates easier:

http://www.micahcarrick.com/gedit-as-a-django-ide-for-linux.html

File:

http://www.micahcarrick.com/code/dtl.lang
Comment 2 Tobias Schönberg 2015-08-20 21:38:47 UTC
Created attachment 309771 [details] [review]
add django-template-language (dtl) spec
Comment 3 Tobias Schönberg 2015-08-24 13:39:15 UTC
I made some more changes to the language definition. It is probably easier to grab the most recent version from here:

https://github.com/tobias47n9e/gedit-django-template-language

Please note that I am also tracking some remaining bugs in the highlighting in that repository.
Comment 4 Tobias Schönberg 2015-08-26 10:49:55 UTC
I posted this bug a while ago that is somewhat related to what this patch should do: https://bugzilla.gnome.org/show_bug.cgi?id=753354
Comment 5 Sébastien Wilmet 2017-01-02 10:30:03 UTC
Review of attachment 309771 [details] [review]:

Looks good, after a quick glance.

Please create a commit that does the other required things: update the Makefile.am, add a test file, etc. As usual.
Comment 6 Tobias Schönberg 2017-01-02 12:03:35 UTC
Created attachment 342711 [details] [review]
dtl.lang: Add Django template language

This commit adds a definition for the Django template
language.
Comment 7 Sébastien Wilmet 2017-01-02 20:03:59 UTC
Review of attachment 342711 [details] [review]:

You forgot to add dtl.lang to po/POTFILES.skip.
The rule of thumb is to do `git grep something.lang`, to see where it appears.
Comment 8 Tobias Schönberg 2017-01-03 09:41:44 UTC
Created attachment 342752 [details] [review]
dtl.lang: Add Django template language

This commit adds a definition for the Django template
language.
Comment 9 Sébastien Wilmet 2017-01-03 18:29:48 UTC
Review of attachment 342752 [details] [review]:

Thanks.
Comment 10 Sébastien Wilmet 2017-01-15 12:10:33 UTC
Attachment 342752 [details] pushed as c393e77 - dtl.lang: Add Django template language
Comment 11 Sébastien Wilmet 2017-01-15 16:30:12 UTC
Review of attachment 342752 [details] [review]:

Actually this commit breaks the unit tests. Run `make check`.
Comment 12 Sébastien Wilmet 2017-01-15 16:31:33 UTC
Review of attachment 342752 [details] [review]:

.

::: data/language-specs/dtl.lang
@@ +26,3 @@
+  <metadata>
+    <property name="mimetypes">text/html;</property>
+    <property name="globs">*.dtl;*.html;</property>

The problem maybe comes from the mimetypes and globs. But it's just a gut feeling.
Comment 13 Tobias Schönberg 2017-01-15 18:12:22 UTC
I ran the tests, and the 18 failed tests don't seem to be related to the lang files. The tests run with gtksourceview 3.99.3, but the rest of my system is on Fedora 25 packages.
Comment 14 Sébastien Wilmet 2017-01-16 10:22:06 UTC
`make check` should succeed on git master and gnome-3-24 (without the patch here). If not, it's a problem with your installation. A recommended way to use git master of a gnome module is to use Jhbuild:

https://wiki.gnome.org/Projects/Jhbuild

Jhbuild installs the modules in a separate prefix to not alter the OS install.
Comment 15 Tobias Schönberg 2017-01-21 22:32:43 UTC
Created attachment 343961 [details] [review]
dtl.lang: Add Django template language

This commit adds a definition for the Django template
language.
Comment 16 Tobias Schönberg 2017-01-21 22:35:03 UTC
It was the trailing ";" in the mimetypes and globs that broke the tests. The new attached patch passes the tests.
Comment 17 Sébastien Wilmet 2017-01-22 09:55:53 UTC
Review of attachment 343961 [details] [review]:

.

::: data/language-specs/dtl.lang
@@ +26,3 @@
+  <metadata>
+    <property name="mimetypes">text/html</property>
+    <property name="globs">*.dtl;*.html</property>

Is it common to have a Django template with the *.html extension? Also it would be nice to have a more precise mimetype.

With this, when opening a normal *.html file, it could be recognized as a Django template, which would be strange even if the highlighting is correct thanks to <context ref="html:html"/>.
Comment 18 Tobias Schönberg 2017-01-28 12:35:59 UTC
Created attachment 344455 [details] [review]
dtl.lang: Add Django template language

This commit adds a definition for the Django template
language.
Comment 19 Sébastien Wilmet 2017-01-28 17:30:04 UTC
Review of attachment 344455 [details] [review]:

Looks better, thanks.
Comment 20 Sébastien Wilmet 2017-01-30 20:44:25 UTC
Pushed: commit 7a7c100b9bac12015393efb87ce652de236bcc3c

(the bug URL is missing in the commit message, it's not a big deal but it's better for later patches to add the bug URL at the end so that from git we can look back at the bugzilla comments and vice-versa).