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 <noahwatk...@gmail.com> 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 <plan...@provplan.org> 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" <noahwatk...@gmail.com> 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 django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > 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 django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > 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 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.