diff --git a/AssemblyVersion.cs b/AssemblyVersion.cs index e6f3040..3fd08f7 100644 --- a/AssemblyVersion.cs +++ b/AssemblyVersion.cs @@ -16,5 +16,5 @@ using System.Reflection; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.0.350")] -[assembly: AssemblyFileVersion("3.0.0.350")] +[assembly: AssemblyVersion("3.0.0.351")] +[assembly: AssemblyFileVersion("3.0.0.351")] diff --git a/WebApplication/Editor.ascx.cs b/WebApplication/Editor.ascx.cs index d7c415c..e69ebf9 100644 --- a/WebApplication/Editor.ascx.cs +++ b/WebApplication/Editor.ascx.cs @@ -203,26 +203,43 @@ namespace ScrewTurn.Wiki { label, s.Name); } else { + bool isPositional = IsSnippetPositional(parameters); label = string.Format("{0} ({1} {2})", s.Name, paramCount, Properties.Messages.Parameters); - sb.AppendFormat(@"{0}", - label, s.Name, GetParametersPlaceHolders(parameters)); + sb.AppendFormat(@"{0}", + label, s.Name, isPositional ? "" : "\\r\\n", GetParametersPlaceHolders(parameters, isPositional)); } } if(sb.Length == 0) sb.Append("" + Properties.Messages.NoSnippets + ""); lblSnippets.Text = sb.ToString(); } + /// + /// Determines whether the parameters of a snippet are positional or not. + /// + /// The parameters. + /// true if the parameters are positional, false otherwise. + private static bool IsSnippetPositional(string[] parameters) { + int dummy; + for(int i = 0; i < parameters.Length; i++) { + if(!int.TryParse(parameters[i], out dummy)) return false; + if(dummy != i + 1) return false; + } + return true; + } + /// /// Gets the placeholder for snippet parameters. /// /// The parameters. + /// A value indicating whether the snippet parameters are positional. /// The snippet placeholder/template. - private static string GetParametersPlaceHolders(string[] parameters) { + private static string GetParametersPlaceHolders(string[] parameters, bool isSnippetPositional) { if(parameters.Length == 0) return ""; else { StringBuilder sb = new StringBuilder(20); foreach(string param in parameters) { - sb.AppendFormat("| {0} = PLACE YOUR VALUE HERE\\r\\n", param); + if(isSnippetPositional) sb.AppendFormat("|PLACE YOUR VALUE HERE ({0})", param); + else sb.AppendFormat("| {0} = PLACE YOUR VALUE HERE\\r\\n", param); } /*for(int i = 1; i <= paramCount; i++) { sb.Append("|P");