Re: style guide/autoformatter/linter for Django templates?

2009-12-01 Thread Antoni Aloy
2009/12/1 Tom Evans :
> On Tue, Dec 1, 2009 at 4:13 PM, Steve Howell  wrote:
>>
>> On Dec 1, 3:33 am, Tom Evans  wrote:
>>> On Tue, Dec 1, 2009 at 7:33 AM, Steve Howell  wrote:
>>> > Just following up on this a few days later, in case it got lost in the
>>> > shuffle due to the weekend and U.S. holiday.
>>>
>>> > On Nov 27, 2:18 pm, Steve Howell  wrote:
>>> >> I am wondering if there is a style guide anywhere for writing Django
>>> >> templates.  Also, are there programs to automatically format your
>>> >> templates...to indent block tags, for example?  I

I have been playing with Ulipad editor,
http://code.google.com/p/ulipad/, it has Django template syntax
support as well as Django project support.

It's a nice and fast editor, and it has one of the best autocomplete
feature for Python and Django that I have seen so far.


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: style guide/autoformatter/linter for Django templates?

2009-12-01 Thread Tom Evans
On Tue, Dec 1, 2009 at 4:13 PM, Steve Howell  wrote:
>
> On Dec 1, 3:33 am, Tom Evans  wrote:
>> On Tue, Dec 1, 2009 at 7:33 AM, Steve Howell  wrote:
>> > Just following up on this a few days later, in case it got lost in the
>> > shuffle due to the weekend and U.S. holiday.
>>
>> > On Nov 27, 2:18 pm, Steve Howell  wrote:
>> >> I am wondering if there is a style guide anywhere for writing Django
>> >> templates.  Also, are there programs to automatically format your
>> >> templates...to indent block tags, for example?  I know there are
>> >> autoformatters for HTML, but I am not aware of any tools that handle
>> >> Django tags.  Also, it would be nice to have a command line tool that
>> >> detected unbalanced tags before rendering occurs, knowing, of course,
>> >> that that task is a little complicated due to conditionals.
>>
>> >> [...]
>>
>> vim 7.2 comes with two syntax, highlighting and indentation modes for django.
>>
>> "set ft=django" for just django template syntax highlighting/indentation
>> "set ft=htmldjango" for mixed HTML/django template syntax highlighting
>>
>
> That's a start, but is there anything that runs from the command
> line?  Am I correct that vim does not indent blocks for django tags,
> only HTML tags?
>

Vim runs from the command line, and could be probably be coerced to
behave like indent. It'd be more than a bit hacky though!

For djangohtml, it uses HTML's indentation rules. There are benefits
to this, your HTML comes out all nicely formed.

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-us...@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: style guide/autoformatter/linter for Django templates?

2009-12-01 Thread Steve Howell

On Dec 1, 3:33 am, Tom Evans  wrote:
> On Tue, Dec 1, 2009 at 7:33 AM, Steve Howell  wrote:
> > Just following up on this a few days later, in case it got lost in the
> > shuffle due to the weekend and U.S. holiday.
>
> > On Nov 27, 2:18 pm, Steve Howell  wrote:
> >> I am wondering if there is a style guide anywhere for writing Django
> >> templates.  Also, are there programs to automatically format your
> >> templates...to indent block tags, for example?  I know there are
> >> autoformatters for HTML, but I am not aware of any tools that handle
> >> Django tags.  Also, it would be nice to have a command line tool that
> >> detected unbalanced tags before rendering occurs, knowing, of course,
> >> that that task is a little complicated due to conditionals.
>
> >> [...]
>
> vim 7.2 comes with two syntax, highlighting and indentation modes for django.
>
> "set ft=django" for just django template syntax highlighting/indentation
> "set ft=htmldjango" for mixed HTML/django template syntax highlighting
>

That's a start, but is there anything that runs from the command
line?  Am I correct that vim does not indent blocks for django tags,
only HTML tags?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: style guide/autoformatter/linter for Django templates?

2009-12-01 Thread Tom Evans
On Tue, Dec 1, 2009 at 7:33 AM, Steve Howell  wrote:
> Just following up on this a few days later, in case it got lost in the
> shuffle due to the weekend and U.S. holiday.
>
> On Nov 27, 2:18 pm, Steve Howell  wrote:
>> I am wondering if there is a style guide anywhere for writing Django
>> templates.  Also, are there programs to automatically format your
>> templates...to indent block tags, for example?  I know there are
>> autoformatters for HTML, but I am not aware of any tools that handle
>> Django tags.  Also, it would be nice to have a command line tool that
>> detected unbalanced tags before rendering occurs, knowing, of course,
>> that that task is a little complicated due to conditionals.
>>
>> [...]
>

vim 7.2 comes with two syntax, highlighting and indentation modes for django.

"set ft=django" for just django template syntax highlighting/indentation
"set ft=htmldjango" for mixed HTML/django template syntax highlighting

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-us...@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: style guide/autoformatter/linter for Django templates?

2009-11-30 Thread Steve Howell
Just following up on this a few days later, in case it got lost in the
shuffle due to the weekend and U.S. holiday.

On Nov 27, 2:18 pm, Steve Howell  wrote:
> I am wondering if there is a style guide anywhere for writing Django
> templates.  Also, are there programs to automatically format your
> templates...to indent block tags, for example?  I know there are
> autoformatters for HTML, but I am not aware of any tools that handle
> Django tags.  Also, it would be nice to have a command line tool that
> detected unbalanced tags before rendering occurs, knowing, of course,
> that that task is a little complicated due to conditionals.
>
> [...]

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




style guide/autoformatter/linter for Django templates?

2009-11-27 Thread Steve Howell
I am wondering if there is a style guide anywhere for writing Django
templates.  Also, are there programs to automatically format your
templates...to indent block tags, for example?  I know there are
autoformatters for HTML, but I am not aware of any tools that handle
Django tags.  Also, it would be nice to have a command line tool that
detected unbalanced tags before rendering occurs, knowing, of course,
that that task is a little complicated due to conditionals.

Here is example code that I would wish to reformat:

{% load i18n %}

{% if show_save %}{% endif %}
{% if show_delete_link %}{% trans "Delete" %}{% endif
%}
{% if show_save_as_new %}{%endif%}
{% if show_save_and_add_another %}{% endif %}
{% if show_save_and_continue %}{% endif %}


It seems like this would be more readable.  The if statements get
indented, except where they are inside an HTML tag.  Also the
statements inside the div get indented.

{% load i18n %}

{% if show_save %}

{% endif %}
{% if show_delete_link %}
{% trans "Delete" %}
{% endif %}
{% if show_save_as_new %}

{%endif%}
{% if show_save_and_add_another %}

{% endif %}
{% if show_save_and_continue %}

{% endif %}


--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.