+1 for A-2, since I find it more consistent and logical for an element that accepts inner content to indent that content, once it spans on multiple lines (since you can also have the inline version). It would be consistent with the indentation policy we apply for HTML as well.
I can't find many arguments for making an exception for them, other than the fact that the velocity and HTML macros tend to be used quite loosely (i.e. pages with entire content wrapped by a start and end velocity macro), but we are talking generally about all rendering macros, so I think it makes sense to indent. The SyntaxHighlighting enabled wiki editor also helps in indenting multiple lines at the same time. Note: One thing that I remember that needs fixing in the SH enabled editor is the "decrease indentation" operation (i.e. SHIFT+TAB should decrease the indentation of the selected lines by one level) which is now configured to do "auto-indentation" instead (i.e. indent the lines to the level dictated by the context, a bit similar to the "Auto-Formatting" option in Eclipse, or other IDEs). However, I don't remember hearing many people complain about this yet, so maybe it's not that painful, but would still need fixing. Thanks, Eduard On Wed, Jun 6, 2018 at 12:59 PM, Thomas Mortagne <[email protected]> wrote: > I'm OK with both but I prefer A-2 which is more readable and more logical > IMO. > > On Wed, Jun 6, 2018 at 11:49 AM, Vincent Massol <[email protected]> > 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 > > > > > > > > -- > Thomas Mortagne >

