> The {{include}} statement is intended to include exactly what is in the
>> included file, starting at the point of the {{include}} -- if the text in
>> the included file is not indented, then neither will it be indented once
>> included. If you want it indented, then you must indent the text in the
>> included file.
>>
>> Also, note that if you are producing HTML, indenting is not necessary
>> anyway.
>>
>> Anthony
>>
>
> Yes I'm producing HTML and I know it's not a big problem since it's not
> affecting to functionality. But still I prefer end result which looks clean
> and is indented in a proper manner. Indenting matters for the readability
> of HTML so I want it to be right.
>
Readability is most important in the files you edit (i.e., the view files).
Why do you need the final HTML to be so readable? If it's for debugging, I
suppose you could always pass the output through something like Beautiful
Soup prettify()
<https://www.crummy.com/software/BeautifulSoup/bs4/doc/#pretty-printing>
when in development.
> I could get a right end result if I manually indent every other than first
> line
>
Or indent everything (including the first line) in the included file but
don't indent the {{include}} in the extended view.
> In my opinion, include statement should work so that it preserves the
> original indentation. So if include statement is indented for example three
> tabs, then every line in included file should be indented three tabs plus
> their indentation in original file.
>
That would not be good default behavior because we can't always assume
leading space represents indentation. Indentation would need to be an
option triggered by some kind of flag.
> Is there any quick fix how I could implement that?
>
I don't think so. I would suggest using an alternative templating engine,
but I don't think others (e.g., Django, Jinja2, Mako) provide this option
either (solutions I've seen require you to specify the indentation level,
somewhat defeating the purpose).
You could probably write a function to add the indentation, but it would
have to be called dynamically on the included template, which would kill
the speed benefit of compiled views.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.