GNOME Bugzilla – Bug 617136
Support for Django
Last modified: 2017-01-30 20:44:25 UTC
Created attachment 159834 [details] Proposed enhancement Attached file adds basic (there is no automatic detection) support for Django/Jinja templates.
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
Created attachment 309771 [details] [review] add django-template-language (dtl) spec
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.
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
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.
Created attachment 342711 [details] [review] dtl.lang: Add Django template language This commit adds a definition for the Django template language.
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.
Created attachment 342752 [details] [review] dtl.lang: Add Django template language This commit adds a definition for the Django template language.
Review of attachment 342752 [details] [review]: Thanks.
Attachment 342752 [details] pushed as c393e77 - dtl.lang: Add Django template language
Review of attachment 342752 [details] [review]: Actually this commit breaks the unit tests. Run `make check`.
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.
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.
`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.
Created attachment 343961 [details] [review] dtl.lang: Add Django template language This commit adds a definition for the Django template language.
It was the trailing ";" in the mimetypes and globs that broke the tests. The new attached patch passes the tests.
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"/>.
Created attachment 344455 [details] [review] dtl.lang: Add Django template language This commit adds a definition for the Django template language.
Review of attachment 344455 [details] [review]: Looks better, thanks.
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).