[xwiki-devs] [Brainstorming] Best practices on indentation for rendering macros in scripts
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
I don't think we need top level indentation to make it clear that a macro is being used so I would go for option A-1. 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
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
+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
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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. 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 <[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
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <[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
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
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
I think just like Caty said. 2018-06-06 13:53 GMT+02:00 Ecaterina Moraru (Valica) <[email protected]>:
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
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
-- Guillaume Delhumeau ([email protected]) Research & Development Engineer at XWiki SAS Committer on the XWiki.org project
With minor exceptions, I use A-2 and I would like to get rid of those exceptions and use only A-2. Thanks, Alex On Wed, Jun 6, 2018 at 2:53 PM, Ecaterina Moraru (Valica) <[email protected]
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
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
Hi Alex,
On 6 Jun 2018, at 13:57, Alex Cotiugă <[email protected]> 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) <[email protected]
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
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
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 <[email protected]> wrote:
Hi Alex,
On 6 Jun 2018, at 13:57, Alex Cotiugă <[email protected]> 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) <
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
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
On 6 Jun 2018, at 14:09, Alex Cotiugă <[email protected]> wrote:
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}}
Ok so this example is A-1 actually ;) With a small variation for nested. And indeed for this variation I also usually do what you pasted too but not always. We’ll need to discuss this variation I agree, but first let’s select what we want for the top elements. If you have only a single top level {{html}} macro do you write: {{html}} <div>… {{/html}} or {{html}} <div>…. {{/html}} ? So to confirm what you’d prefer is the second one, i.e. A-2 for all rendering macros located at the top level right? Thanks -Vincent
On Wed, Jun 6, 2018 at 3:02 PM, Vincent Massol <[email protected]> wrote:
Hi Alex,
On 6 Jun 2018, at 13:57, Alex Cotiugă <[email protected]> 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) <
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 <[email protected]> wrote:
On 6 Jun 2018, at 13:24, Vincent Massol <[email protected]> wrote:
> On 6 Jun 2018, at 12:37, Eduard Moraru <[email protected]> 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 <
> 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
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 <[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
Hi, Not a matter of preference for me, since not all macro contents afford being indended, A-1 is the most natural option IMO. Regards, -- Denis Gervalle On 6 Jun 2018, 11:49 +0200, 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
participants (9)
-
Adel Atallah -
Alex Cotiugă -
Denis Gervalle -
Ecaterina Moraru (Valica) -
Eduard Moraru -
Guillaume Delhumeau -
Marius Dumitru Florea -
Thomas Mortagne -
Vincent Massol