Re: syntax highlighting for template files and file suffix

2011-08-23 Thread Tom Evans
On Tue, Aug 23, 2011 at 12:09 PM, Gelonida N  wrote:
> Hi,
>
> I'm rather new to Django and just start working with a little more with
> templates.
>
> I wondered how to make a distinction between html files and html templates.
>
> Shall I used different suffixes or is the directory location enough.
>
> If I don't have different file suffixes, how do you teach your editor,
> when editing an html file and when editing a template file.
>
>
> I am using vim
>
> Are there any 'best practices'?
>

I tell vim (in ~/.vimrc) to assume that files named */templates/*.html
are django templates:

au BufRead */templates/*.html set ft=htmldjango sw=2 ts=2

This is good enough for me, you may want to adjust the pattern if you
often edit html files within a directory named templates that are not
django templates.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: syntax highlighting for template files and file suffix

2011-08-23 Thread Paul Schewietzek
With vim, you can ':setfiletype htmldjango' for django templates (on Debian
6 at least).

Hope that helps.



2011/8/23 Herman Schistad 

> On Tue, Aug 23, 2011 at 13:09, Gelonida N  wrote:
> > I'm rather new to Django and just start working with a little more with
> > templates.
> >
> > I wondered how to make a distinction between html files and html
> templates.
> >
> > Shall I used different suffixes or is the directory location enough.
> >
> > If I don't have different file suffixes, how do you teach your editor,
> > when editing an html file and when editing a template file.
>
> If say you have all the .html files in your templates/ folder, it
> should all be good. Suffix is .html
>
> Best practice I guess is to create as base.html which defines your
> structure, and say:
> (...)
> 
>{% block content %}{% endblock %}
> 
> (...)
>
> And later in another document you just define the content like this:
> {% extends "base.html" %}
> (...)
> {% block content %}
>Your custom content here.
> {% endblock %}
> (...)
>
> --
> With regards, Herman Schistad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: syntax highlighting for template files and file suffix

2011-08-23 Thread Herman Schistad
On Tue, Aug 23, 2011 at 13:09, Gelonida N  wrote:
> I'm rather new to Django and just start working with a little more with
> templates.
>
> I wondered how to make a distinction between html files and html templates.
>
> Shall I used different suffixes or is the directory location enough.
>
> If I don't have different file suffixes, how do you teach your editor,
> when editing an html file and when editing a template file.

If say you have all the .html files in your templates/ folder, it
should all be good. Suffix is .html

Best practice I guess is to create as base.html which defines your
structure, and say:
(...)

{% block content %}{% endblock %}

(...)

And later in another document you just define the content like this:
{% extends "base.html" %}
(...)
{% block content %}
Your custom content here.
{% endblock %}
(...)

-- 
With regards, Herman Schistad

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.