Not the prettiest thing in the world, but there's always:
<pre>
header
{% if var1 %}{{ ... }}
{% endif %}{% if var2 %}{{ ... }}
{% endif %}{% if var3 %}{{ ... }}
{% endif %}
footer
</pre>
Regards
Scott
On May 12, 2:20 pm, Noah Watkins <[email protected]> wrote:
> Peter
>
> I don't believe "spaceless" will work because in the example I posted
> there are no html tags within the <pre></pre> block.
> Consider the same example where var2 is evaluated to be false:
>
> <pre>
> header
> ...
> --NEWLINE--
> ...
> footer
> </pre>
>
> The newline remains, but is displayed on a webpage because it is in
> the <pre> block.
>
> On May 12, 11:10 am, Peter Landry <[email protected]> wrote:
>
>
>
>
>
> > If you want to keep the newlines in your template, you can
> > usehttp://docs.djangoproject.com/en/1.1/ref/templates/builtins/#spaceless
>
> > Peter
>
> > On 5/12/10 2:02 PM, "Noah Watkins" <[email protected]> wrote:
>
> > > I have a variable amount of lines that need to be displayed in a
> > > <pre></pre> block:
>
> > > <pre>
> > > header
> > > {% if var1 %}{{ ... }}{% endif %}
> > > {% if var2 %}{{ ... }}{% endif %}
> > > {% if var3 %}{{ ... }}{% endif %}
> > > footer
> > > </pre>
>
> > > However, if some of the if-statements are not evaluated to be true
> > > then the line breaks are still displayed in the pre area causing
> > > "gaps". Are there any easy approaches to addressing this issue?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.