My exception is in indenting just after {{velocity}}, which I don't do, but for other macros {{html}}, {{info}}. Here's an example: {{velocity}} #macro (displayProperty $propertyName) {{html clean="false"}} <div class="row"> #if ($xcontext.action == 'edit') $doc.getValue($propertyName) #end </div> {{/html}} #end {{/velocity}}
On Wed, Jun 6, 2018 at 3:02 PM, Vincent Massol <vinc...@massol.net> wrote: > Hi Alex, > > > On 6 Jun 2018, at 13:57, Alex Cotiugă <alexandru.coti...@xwiki.com> > wrote: > > > > With minor exceptions, I use A-2 and I would like to get rid of those > > exceptions and use only A-2. > > Could you explain what you have in mind by “minor exceptions”? > > AFAIK you use A-1 and not A-2 since I don’t think we have any committed > code using A-2 ATM (I could be wrong). > > Maybe you meant A-1? > > Thanks > -Vincent > > > > > Thanks, > > Alex > > > > On Wed, Jun 6, 2018 at 2:53 PM, Ecaterina Moraru (Valica) < > vali...@gmail.com > >> wrote: > > > >> I like and use A-1 > >> > >> I like syntax highlighting and I don't want it disabled by default. > >> > >> Thanks, > >> Caty > >> > >> On Wed, Jun 6, 2018 at 2:25 PM, Vincent Massol <vinc...@massol.net> > wrote: > >> > >>> > >>> > >>>> On 6 Jun 2018, at 13:24, Vincent Massol <vinc...@massol.net> wrote: > >>>> > >>>> > >>>> > >>>>> On 6 Jun 2018, at 12:37, Eduard Moraru <enygma2...@gmail.com> wrote: > >>>>> > >>>>> +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. > >>>> > >>>> Well on my side I curse the syntax highlighting almost every single > >> day… > >>> :( > >>>> > >>>> Honestly, right now, I would very much prefer to just disable it by > >>> default. > >>> > >>> Before someone says I can disable it, I use new xwiki instances every > >> day. > >>> > >>> And on shared instances, I don’t think you can turn it off just for > your > >>> user ATM. > >>> > >>> Thanks > >>> -Vincent > >>> > >>>> > >>>> I do lots of testing every day, using velocity and groovy macros and > >> the > >>> indentation costs me way too much time than it should, especially for > >> macro > >>> closing. In my use cases the coloring is a nice to have but it’s not > >> really > >>> needed (I only have a few lines) but the extra keystrokes needed for > >>> unindenting are a pain. > >>>> > >>>> Thanks > >>>> -Vincent > >>>> > >>>>> > >>>>> Thanks, > >>>>> Eduard > >>>>> > >>>>> On Wed, Jun 6, 2018 at 12:59 PM, Thomas Mortagne < > >>> thomas.morta...@xwiki.com> > >>>>> 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 <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 > >>>>>>> > >>>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> Thomas Mortagne > >>> > >>> > >> > >