I've always used A-1 and I'd like to keep it that way.

Thanks,
Marius

On Wed, Jun 6, 2018 at 12:49 PM, Vincent Massol <vinc...@massol.net> wrote:

> Hi,
>
> Context 1: https://jira.xwiki.org/browse/WIKIEDITOR-58
> Context 2: Fill the “velocity code style” section of
> http://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/
>
> Option A-1: No top level indentation
> =========================
>
> {{velocity}}
> #set ($var = …)
> #if (…)
>   …
>   #if (…)
>   #end
> #end
> {{/velocity}}
>
> Nested example:
>
> {{velocity}}
> #if ($doc.fullName != 'XWiki.AdminInlineSheet')
>   #set($formname = 'inline')
>   #set($saveaction = 'save')
>   #set($previewenabled = true)
>   #set($xnotification = $!request.getParameter('xnotification'))
>   {{html}}
>   <form id="inline" method="post" action="$doc.getURL('preview’)">
>     <div>
>     …
> {{/velocity}}
>
> Pros:
> * This is what we currently do which IMO means it’s the more natural way
> * Makes content more visible when editing inside xwiki since it takes less
> horizontal space
> * Less typing and less chance to make it wrong
>
> Option A-2: Top level indentation
> ========================
>
> {{velocity}}
>   #set ($var = …)
>   #if (…)
>     …
>     #if (…)
>     #end
>   #end
> {{/velocity}}
>
> Nested example:
>
> {{velocity}}
>   #if ($doc.fullName != 'XWiki.AdminInlineSheet')
>     #set($formname = 'inline')
>     #set($saveaction = 'save')
>     #set($previewenabled = true)
>     #set($xnotification = $!request.getParameter('xnotification'))
>     {{html}}
>       <form id="inline" method="post" action="$doc.getURL('preview’)">
>         <div>
>         …
> {{/velocity}}
>
> Pros:
> * More logical since a macro is a container (even though it’s different
> syntax - wiki markup vs velocity - so it’s arguable)
> * More legible?
>
> Cons
> * This means slowly changing everywhere we use scripting.
>
> WDYT?
>
> I think my preference goes to A-1 FTM since I’ve never thought to myself
> that it was an issue all these years of using it.
>
> Thanks
> -Vincent
>
>
>

Reply via email to