Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] How many spaces of indentation in templates?

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] How many spaces of indentation in templates?
  • Date: Fri, 11 Jan 2019 11:04:35 +0100

Hi Luc,

I prefer 4 spaces too.

Related question:

I, like Soji, tend to have exceptions for HTML. Namely, I try to distinguish TT2 tags indentation and the resulting HTML indentation.

I make a large usage of ending dashes (like in [% FOREACH -%]) in TT2 tags to allow to isolate these tags on single lines to prevent making their indentation to impact HTML.

Example:

<ol>

[% FOREACH dude IN dudes -%]

    [% IF dude.emails -%]

        [% FOREACH email IN dude.emails -%]

            [% IF email.canonical -%]

    <li>[% email.value %]</li>

            [% ENDIF -%]

        [% ENDFOR -%]

    [% ENDIF -%]

[% ENDFOR -%]

</ol>

Which would give :

<ol>

    <li>address@concealed</li>

    <li>address@concealed</li>

    <li>address@concealed</li>

</ol>

Whereas without the ending dashes, it would give:

<ol>





    <li>address@concealed</li>






 



    <li>address@concealed</li>

 

 

 






    <li>address@concealed</li>





</ol>

Regards,

David


On 11/01/2019 09:49, IKEDA Soji wrote:
Hi,

I’m using 2 spaces for both tt2 elements and HTML elements (and there are some exception rules when HTML is enclosed by tt2, ...a bit hard to describe).

If another method was agreed, I won’t stick to my method.

2019/01/11 17:21、Luc Didry <address@concealed>のメール:

Hello,

I plan to correct indentation in the default tt2 template files to
make them more readable. How many spaces should I use? I saw templates
with 2 spaces and 4 spaces.

My personal preference is 4 spaces, like in the perl files.
-- 
Luc
"La route est longue, mais la voie est libre…" https://framasoft.org

Framasoft ne vit que par vos dons (déductibles des impôts). Merci d'avance pour votre soutien https://soutenir.framasoft.org





-- 
"Mieux vaut viser la perfection et la rater que viser la médiocrité et l'atteindre."
- Francis Blanche

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.19+.

Top of Page