Modified:
/trunk/MonoRail/Castle.MonoRail.Framework.Tests/
ServerUtilityTestCase.cs
/trunk/MonoRail/Castle.MonoRail.Framework/Adapters/
ServerUtilityAdapter.cs
Log:
The single quote wasn't escaped.
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Framework/Adapters/
==============================================================
File [modified]: ServerUtilityAdapter.cs
Delta lines: +1 -1
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Framework/Adapters/ServerUtilityAdapter.cs 2007-03-21 12:22:16 UTC (rev 3626)
+++ trunk/MonoRail/Castle.MonoRail.Framework/Adapters/ServerUtilityAdapter.cs 2007-03-21 14:39:38 UTC (rev 3627)
@@ -53,7 +53,7 @@
{
// TODO: Replace by a regular expression, which should be much more efficient
- return content.Replace("\"", "\\\"").Replace("\r", "").Replace("\n", "\\n");
+ return content.Replace("\"", "\\\"").Replace("\r", "").Replace("\n", "\\n").Replace("'","\\'");
}
/// <summary>
Directory: /trunk/MonoRail/Castle.MonoRail.Framework.Tests/
===========================================================
File [modified]: ServerUtilityTestCase.cs
Delta lines: +2 -2
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Framework.Tests/ServerUtilityTestCase.cs 2007-03-21 12:22:16 UTC (rev 3626)
+++ trunk/MonoRail/Castle.MonoRail.Framework.Tests/ServerUtilityTestCase.cs 2007-03-21 14:39:38 UTC (rev 3627)
@@ -51,9 +51,9 @@
[Test]
public void JavaScriptEscape()
{
- DoGet("ServerUtility/JavaScriptEscape.rails", "content=some js \" content \"");
+ DoGet("ServerUtility/JavaScriptEscape.rails", "content=some js \" content \", test's");
- AssertReplyEqualTo("some js \\\" content \\\"");
+ AssertReplyEqualTo("some js \\\" content \\\", test\\'s");
}
}
}
Modified:
/trunk/MonoRail/
Changes.txt
/trunk/MonoRail/Castle.MonoRail.Framework/Helpers/
FormHelper.cs
Log:
- Applied Chris Ortman's patch fixing MR-235
"Allow overriding of select generation in FormHelper"
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Framework/Helpers/
=============================================================
File [modified]: FormHelper.cs
Delta lines: +42 -17
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Framework/Helpers/FormHelper.cs 2007-03-24 00:34:23 UTC (rev 3635)
+++ trunk/MonoRail/Castle.MonoRail.Framework/Helpers/FormHelper.cs 2007-03-24 00:39:31 UTC (rev 3636)
@@ -752,7 +752,7 @@
/// <summary>
/// Creates a <see cref="CheckboxList"/> instance
/// which is enumerable. For each interaction you can invoke
- /// <see cref="CheckboxList.Item"/> which will correctly render
+ /// <see cref="CheckboxList.Item()"/> which will correctly render
/// a checkbox input element for the current element on the supplied set (<c>dataSource</c>).
/// <para>
/// The enumerable item will be an element of the <c>dataSource</c>.
@@ -779,7 +779,7 @@
/// <summary>
/// Creates a <see cref="CheckboxList"/> instance
/// which is enumerable. For each interaction you can invoke
- /// <see cref="CheckboxList.Item"/> which will correctly render
+ /// <see cref="CheckboxList.Item()"/> which will correctly render
/// a checkbox input element for the current element on the supplied set (<c>dataSource</c>).
/// <para>
/// The enumerable item will be an element of the <c>dataSource</c>.
@@ -830,7 +830,7 @@
target = String.Format("{0}[{1}]", target, index);
- string elementId = CreateHtmlId(attributes, target, false);
+ string elementId = CreateHtmlId(attributes, target, true);
string computedTarget = target;
@@ -877,22 +877,41 @@
}
/// <summary>
- ///
+ /// Outputs the Checkbox in the correct state (checked/unchecked) based
+ /// on the Set.
+ /// <seealso cref="FormHelper.CreateCheckboxList(string,IEnumerable,IDictionary)"/>
/// </summary>
- /// <returns>The generated form element</returns>
+ /// <returns>The generated input element</returns>
public string Item()
{
+ return Item(null);
+ }
+
+ /// <summary>
+ /// Outputs the Checkbox in the correct state (checked/unchecked) based
+ /// on the Set.
+ /// <seealso cref="FormHelper.CreateCheckboxList(string,IEnumerable,IDictionary)"/>
+ /// </summary>
+ /// <param name="id">The element id</param>
+ /// <returns>The generated input element</returns>
+ public string Item(string id)
+ {
if (!hasMovedNext)
{
throw new InvalidOperationException("Before rendering a checkbox item, you must use MoveNext");
}
-
+
if (!hasItem)
{
// Nothing to render
return String.Empty;
}
-
+
+ if (id != null)
+ {
+ attributes["id"] = id;
+ }
+
return helper.CheckboxItem(index, target, operationState.TargetSuffix, CurrentSetItem, attributes);
}
@@ -1147,6 +1166,12 @@
/// <returns>The generated form element</returns>
public string Select(string target, object selectedValue, IEnumerable dataSource, IDictionary attributes)
{
+ return GenerateSelect(target, selectedValue, dataSource, attributes);
+ }
+
+ protected virtual string GenerateSelect(string target, object selectedValue, IEnumerable dataSource,
+ IDictionary attributes)
+ {
string id = CreateHtmlId(target);
ApplyValidation(InputElementType.Select, target, ref attributes);
@@ -1159,18 +1184,18 @@
string firstOptionValue = null;
string name = target;
- if (attributes != null)
+ if (attributes != null)
{
firstOption = CommonUtils.ObtainEntryAndRemove(attributes, "firstoption");
firstOptionValue = CommonUtils.ObtainEntryAndRemove(attributes, "firstoptionvalue");
-
- if (attributes.Contains("name"))
+
+ if (attributes.Contains("name"))
{
name = (String) attributes["name"];
attributes.Remove("name");
}
- if (attributes.Contains("id"))
+ if (attributes.Contains("id"))
{
id = (String) attributes["id"];
attributes.Remove("id");
@@ -1187,7 +1212,7 @@
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteLine();
- if (firstOption != null)
+ if (firstOption != null)
{
writer.WriteBeginTag("option");
writer.WriteAttribute("value", (firstOptionValue == null) ? "0" : firstOptionValue);
@@ -1196,12 +1221,12 @@
writer.WriteEndTag("option");
writer.WriteLine();
}
-
- foreach(SetItem item in state)
+
+ foreach(SetItem item in state)
{
writer.WriteBeginTag("option");
-
- if (item.IsSelected)
+
+ if (item.IsSelected)
{
writer.Write(" selected=\"selected\"");
}
@@ -1212,7 +1237,7 @@
writer.WriteEndTag("option");
writer.WriteLine();
}
-
+
writer.WriteEndTag("select");
return sbWriter.ToString();
Directory: /trunk/MonoRail/
===========================
File [modified]: Changes.txt
Delta lines: +6 -0
===================================================================
--- trunk/MonoRail/Changes.txt 2007-03-24 00:34:23 UTC (rev 3635)
+++ trunk/MonoRail/Changes.txt 2007-03-24 00:39:31 UTC (rev 3636)
@@ -4,6 +4,12 @@
Release Candidate 3
===================
+- Applied Chris Ortman's patch fixing MR-235
+ "Allow overriding of select generation in FormHelper"
+
+- Added Item(string id) overload to Checkboxlist
+ Used to generate a checkbox with the specified id. Useful to label for='id' constructions
+
- Added the Expect property to the ARDataBindAttr. Now it will clear the collections
that are declared as expected, if not can be found on the resquest params. (MR-163)
Modified:
/trunk/MonoRail/
Changes.txt
/trunk/MonoRail/Castle.MonoRail.Framework/Internal/
ResourceFacade.cs
/trunk/MonoRail/Castle.MonoRail.Framework/Services/
DefaultResourceFactory.cs
Log:
- Applied Aaron Jensen's patch fixing the Resource Manager usage
Changed from ResourceSet to ResourceManager
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Framework/Internal/
==============================================================
File [modified]: ResourceFacade.cs
Delta lines: +13 -11
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Framework/Internal/ResourceFacade.cs 2007-03-28 03:22:53 UTC (rev 3649)
+++ trunk/MonoRail/Castle.MonoRail.Framework/Internal/ResourceFacade.cs 2007-03-28 03:23:34 UTC (rev 3650)
@@ -15,39 +15,41 @@
namespace Castle.MonoRail.Framework.Internal
{
using System;
+ using System.Globalization;
using System.Resources;
/// <summary>
/// Simple facade that provides the IResource interface to a
- /// ResourceSet instance.
+ /// ResourceManager instance.
/// </summary>
public class ResourceFacade : IResource
{
- private readonly ResourceSet resourceSet;
+ private readonly ResourceManager resourceManager;
+ private readonly CultureInfo cultureInfo;
- public ResourceFacade(ResourceSet resourceSet)
+ public ResourceFacade(ResourceManager resourceManager, CultureInfo cultureInfo)
{
- this.resourceSet = resourceSet;
+ this.resourceManager = resourceManager;
+ this.cultureInfo = cultureInfo;
}
- public object this[String key]
+ public object GetObject(string key)
{
- get { return GetObject( key ); }
+ return resourceManager.GetObject(key, cultureInfo);
}
- public String GetString(String key)
+ public string GetString(string key)
{
- return key != null ? resourceSet.GetString(key, true) : null;
+ return resourceManager.GetString(key, cultureInfo);
}
- public object GetObject(String key)
+ public object this[string key]
{
- return key != null ? resourceSet.GetObject(key, true) : null;
+ get { return resourceManager.GetObject(key, cultureInfo); }
}
public void Dispose()
{
- resourceSet.Dispose();
}
}
}
Directory: /trunk/MonoRail/
===========================
File [modified]: Changes.txt
Delta lines: +3 -0
===================================================================
--- trunk/MonoRail/Changes.txt 2007-03-28 03:22:53 UTC (rev 3649)
+++ trunk/MonoRail/Changes.txt 2007-03-28 03:23:34 UTC (rev 3650)
@@ -4,6 +4,9 @@
Release Candidate 3
===================
+- Applied Aaron Jensen's patch fixing the Resource Manager usage
+ Changed from ResourceSet to ResourceManager
+
- Applied Lee Henson's patch adding the 'onCreateAdvice'
to PrototypeWebValidator
Directory: /trunk/MonoRail/Castle.MonoRail.Framework/Services/
==============================================================
File [modified]: DefaultResourceFactory.cs
Delta lines: +4 -6
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Framework/Services/DefaultResourceFactory.cs 2007-03-28 03:22:53 UTC (rev 3649)
+++ trunk/MonoRail/Castle.MonoRail.Framework/Services/DefaultResourceFactory.cs 2007-03-28 03:23:34 UTC (rev 3650)
@@ -63,19 +63,17 @@
/// <returns></returns>
public IResource Create(ResourceDescriptor descriptor, Assembly appAssembly)
{
- Assembly resAssembly = ResolveAssembly(descriptor.AssemblyName, appAssembly);
- CultureInfo culture = ResolveCulture(descriptor.CultureName);
+ Assembly assembly = this.ResolveAssembly(descriptor.AssemblyName, appAssembly);
+ CultureInfo cultureInfo = this.ResolveCulture(descriptor.CultureName);
if (logger.IsDebugEnabled)
{
logger.DebugFormat("Creating resource name {0}, assembly {1}, resource {2}",
descriptor.Name, descriptor.AssemblyName, descriptor.ResourceName);
}
-
- ResourceManager rm = new ResourceManager(descriptor.ResourceName,
- resAssembly, descriptor.ResourceType);
- return new ResourceFacade(rm.GetResourceSet(culture, true, true));
+ ResourceManager manager = new ResourceManager(descriptor.ResourceName, assembly, descriptor.ResourceType);
+ return new ResourceFacade(manager, cultureInfo);
}
/// <summary>
Added:
/trunk/MonoRail/TestSiteBrail/Views/home/
namespacesInConfig.brail
Modified:
/trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
BrailBasicFunctionality.cs
/trunk/MonoRail/TestSiteBrail/
TestSiteBrail.csproj, web.config
/trunk/MonoRail/TestSiteBrail/Controllers/
HomeController.cs
Log:
Test for MR-238 - namespaces in config.
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
=============================================================
File [modified]: BrailBasicFunctionality.cs
Delta lines: +8 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailBasicFunctionality.cs 2007-03-28 07:08:55 UTC (rev 3651)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailBasicFunctionality.cs 2007-03-28 07:18:27 UTC (rev 3652)
@@ -131,5 +131,13 @@
";
AssertReplyEqualTo(expected);
}
+
+ [Test]
+ public void CanUseNamespacesFromConfig()
+ {
+ string expected = "Using Udp without namespace, since it is in the web.config\r\n";
+ DoGet("home/namespacesInConfig.rails");
+ AssertReplyEqualTo(expected);
+ }
}
}
Directory: /trunk/MonoRail/TestSiteBrail/Controllers/
=====================================================
File [modified]: HomeController.cs
Delta lines: +4 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Controllers/HomeController.cs 2007-03-28 07:08:55 UTC (rev 3651)
+++ trunk/MonoRail/TestSiteBrail/Controllers/HomeController.cs 2007-03-28 07:18:27 UTC (rev 3652)
@@ -129,6 +129,10 @@
}
+ public void NamespacesInConfig()
+ {
+
+ }
}
}
Directory: /trunk/MonoRail/TestSiteBrail/
=========================================
File [modified]: TestSiteBrail.csproj
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 07:08:55 UTC (rev 3651)
+++ trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 07:18:27 UTC (rev 3652)
@@ -130,6 +130,7 @@
<Compile Include="Controllers\XmlController.cs" />
<Compile Include="Helpers\DateFormatHelper.cs" />
<None Include="Views\HappenedOnTheField\JustComponent.brail" />
+ <None Include="Views\home\namespacesInConfig.brail" />
<None Include="Views\home\withDynamicProxyObject.brail" />
<None Include="Views\home\repeater.brail" />
<None Include="Views\home\WithNothingAfterTheLastSeperator.brail" />
File [modified]: web.config
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/web.config 2007-03-28 07:08:55 UTC (rev 3651)
+++ trunk/MonoRail/TestSiteBrail/web.config 2007-03-28 07:18:27 UTC (rev 3652)
@@ -41,6 +41,7 @@
batch="false"
commonScriptsDirectory="CommonScripts">
<reference assembly="Castle.MonoRail.Framework"/>
+ <import namespace="System.Net"/>
</Brail>
<system.web>
Directory: /trunk/MonoRail/TestSiteBrail/Views/home/
====================================================
File [added]: namespacesInConfig.brail
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Views/home/namespacesInConfig.brail (rev 0)
+++ trunk/MonoRail/TestSiteBrail/Views/home/namespacesInConfig.brail 2007-03-28 07:18:27 UTC (rev 3652)
@@ -0,0 +1 @@
+Using ${TransportType.Connectionless} without namespace, since it is in the web.config
Added:
/trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
BrailBugsTestCase.cs
/trunk/MonoRail/TestSiteBrail/Controllers/
BugsController.cs
/trunk/MonoRail/TestSiteBrail/Views/bugs/
mr_233.brail
Modified:
/trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
BrailAjaxTestCase.cs, Castle.MonoRail.Views.Brail.Tests-vs2005.csproj
/trunk/MonoRail/Castle.MonoRail.Views.Brail/
BrailPreProcessor.cs
/trunk/MonoRail/Castle.MonoRail.Views.Brail/Macros/
OutputMacro.cs
/trunk/MonoRail/TestSiteBrail/
TestSiteBrail.csproj
/trunk/MonoRail/TestSiteBrail/Views/helper/
InheritedHelpers.brail
/trunk/MonoRail/TestSiteBrail/Views/home/
nullableProperties.brail
Log:
Fixing MR-233 - Brail tag in double quotation marks is giving an error
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail/
=======================================================
File [modified]: BrailPreProcessor.cs
Delta lines: +24 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail/BrailPreProcessor.cs 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail/BrailPreProcessor.cs 2007-03-28 20:13:01 UTC (rev 3654)
@@ -25,6 +25,8 @@
public class BrailPreProcessor : AbstractCompilerStep
{
+ public const string ClosingQuoteReplacement = "`^`";
+ public const string DoubleQuote = "\"";
private static IDictionary Seperators = CreateSeperators();
private BooViewEngine booViewEngine;
private IDictionary inputToCode = new Hashtable();
@@ -117,13 +119,25 @@
{
if (code.Length == 0)
return;
+ //This remove double quotes from ${}
code = RemoveDoubleQuotesFromExpressions(code);
buffer.WriteLine();
buffer.Write("output \"\"\"");
+ //This remove inital and closing double quotes from text
+ code = EscapeInitialAndClosingDoubleQuotes(code);
buffer.Write(code);
buffer.WriteLine("\"\"\"");
}
+ private static string EscapeInitialAndClosingDoubleQuotes(string code)
+ {
+ if (code.StartsWith(DoubleQuote))
+ code = ClosingQuoteReplacement + code.Substring(DoubleQuote.Length);
+ if (code.EndsWith(DoubleQuote))
+ code = code.Substring(0, code.Length - DoubleQuote.Length) + ClosingQuoteReplacement;
+ return code;
+ }
+
/// <summary>
/// This will replace any " inside a ${ } expressions with a ', because it breaks the parser
/// otherwise.
@@ -222,5 +236,15 @@
}
return new DictionaryEntry(start, end);
}
+
+ public static string UnescapeInitialAndClosingDoubleQuotes(string code)
+ {
+ if (code.StartsWith(ClosingQuoteReplacement))
+ code = DoubleQuote + code.Substring(ClosingQuoteReplacement.Length);
+ if (code.EndsWith(ClosingQuoteReplacement))
+ code = code.Substring(0, code.Length - ClosingQuoteReplacement.Length) +
+ DoubleQuote;
+ return code;
+ }
}
}
\ No newline at end of file
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
=============================================================
File [modified]: BrailAjaxTestCase.cs
Delta lines: +1 -1
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailAjaxTestCase.cs 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailAjaxTestCase.cs 2007-03-28 20:13:01 UTC (rev 3654)
@@ -24,7 +24,7 @@
public void JsFunctions()
{
DoGet("ajax/JsFunctions.rails");
- string expected = "<script type=\"text/javascript\" src=\"/MonoRail/Files/AjaxScripts.rails?RC3_0001\"></script>";
+ string expected = "<script type=\"text/javascript\" src=\"/MonoRail/Files/AjaxScripts.rails?RC3_0002\"></script>";
AssertSuccess();
AssertReplyEqualTo(expected);
}
File [added]: BrailBugsTestCase.cs
Delta lines: +31 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailBugsTestCase.cs (rev 0)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/BrailBugsTestCase.cs 2007-03-28 20:13:01 UTC (rev 3654)
@@ -0,0 +1,31 @@
+// Copyright 2004-2007 Castle Project - http://www.castleproject.org/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.MonoRail.Views.Brail.Tests
+{
+ using Castle.MonoRail.Framework.Tests;
+ using NUnit.Framework;
+
+ [TestFixture]
+ public class BrailBugsTestCase : AbstractTestCase
+ {
+ [Test]
+ public void MR_233_TagInDoubleQuotes()
+ {
+ DoGet("bugs/mr_233.rails");
+ AssertSuccess();
+ AssertReplyEqualTo("<body id=\"123\">");
+ }
+ }
+}
File [modified]: Castle.MonoRail.Views.Brail.Tests-vs2005.csproj
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/Castle.MonoRail.Views.Brail.Tests-vs2005.csproj 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/Castle.MonoRail.Views.Brail.Tests-vs2005.csproj 2007-03-28 20:13:01 UTC (rev 3654)
@@ -46,6 +46,7 @@
<Compile Include="ComponentsTestCase.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\LayoutController.cs" />
+ <Compile Include="BrailBugsTestCase.cs" />
<Compile Include="DirectRenderTestCase.cs" />
<Compile Include="HappenedOnTheFieldFixture.cs" />
<Compile Include="JSGenerationTestCase.cs" />
Directory: /trunk/MonoRail/TestSiteBrail/Controllers/
=====================================================
File [added]: BugsController.cs
Delta lines: +30 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Controllers/BugsController.cs (rev 0)
+++ trunk/MonoRail/TestSiteBrail/Controllers/BugsController.cs 2007-03-28 20:13:01 UTC (rev 3654)
@@ -0,0 +1,30 @@
+// Copyright 2004-2007 Castle Project - http://www.castleproject.org/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.MonoRail.Views.Brail.TestSite.Controllers
+{
+ using Castle.MonoRail.Framework;
+ using System;
+
+ [Serializable]
+ public class BugsController : SmartDispatcherController
+ {
+ public void MR_233()
+ {
+ //Brail tag in double quotation marks is giving an error
+ PropertyBag["page_id"] = 123;
+ }
+ }
+}
+
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail/Macros/
==============================================================
File [modified]: OutputMacro.cs
Delta lines: +9 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail/Macros/OutputMacro.cs 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail/Macros/OutputMacro.cs 2007-03-28 20:13:01 UTC (rev 3654)
@@ -29,7 +29,16 @@
{
if (macro.Arguments.Count == 0)
throw new RailsException("output must be called with arguemnts");
+ UnescapeInitialAndClosingDoubleQuotes(macro);
return Expand(macro, output, output);
}
+
+ private static void UnescapeInitialAndClosingDoubleQuotes(MacroStatement macro)
+ {
+ StringLiteralExpression value = macro.Arguments[0] as StringLiteralExpression;
+ if(value==null)
+ return;
+ value.Value = BrailPreProcessor.UnescapeInitialAndClosingDoubleQuotes(value.Value);
+ }
}
}
Directory: /trunk/MonoRail/TestSiteBrail/
=========================================
File [modified]: TestSiteBrail.csproj
Delta lines: +2 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 20:13:01 UTC (rev 3654)
@@ -107,6 +107,7 @@
<Compile Include="Controllers\AppPathController.cs" />
<Compile Include="Controllers\BlogController.cs" />
<Compile Include="Controllers\CookiesController.cs" />
+ <Compile Include="Controllers\BugsController.cs" />
<Compile Include="Controllers\DefaultLayoutController.cs" />
<Compile Include="Controllers\DirectRenderController.cs" />
<Compile Include="Controllers\DummySubView.cs" />
@@ -129,6 +130,7 @@
<Compile Include="Controllers\UsingComponentsController.cs" />
<Compile Include="Controllers\XmlController.cs" />
<Compile Include="Helpers\DateFormatHelper.cs" />
+ <None Include="Views\bugs\mr_233.brail" />
<None Include="Views\HappenedOnTheField\JustComponent.brail" />
<None Include="Views\home\namespacesInConfig.brail" />
<None Include="Views\home\withDynamicProxyObject.brail" />
Directory: /trunk/MonoRail/TestSiteBrail/Views/bugs/
====================================================
File [added]: mr_233.brail
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Views/bugs/mr_233.brail (rev 0)
+++ trunk/MonoRail/TestSiteBrail/Views/bugs/mr_233.brail 2007-03-28 20:13:01 UTC (rev 3654)
@@ -0,0 +1 @@
+<body id="<?brail output page_id ?>">
\ No newline at end of file
Directory: /trunk/MonoRail/TestSiteBrail/Views/helper/
======================================================
File [modified]: InheritedHelpers.brail
Delta lines: +1 -1
===================================================================
--- trunk/MonoRail/TestSiteBrail/Views/helper/InheritedHelpers.brail 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/TestSiteBrail/Views/helper/InheritedHelpers.brail 2007-03-28 20:13:01 UTC (rev 3654)
@@ -1 +1 @@
-Date formatted ${DateFormatHelper.FormatDate( date )}
\ No newline at end of file
+Date formatted ${DateFormatHelper.ToShortDate( date )}
\ No newline at end of file
Directory: /trunk/MonoRail/TestSiteBrail/Views/home/
====================================================
File [modified]: nullableProperties.brail
Delta lines: +1 -1
===================================================================
--- trunk/MonoRail/TestSiteBrail/Views/home/nullableProperties.brail 2007-03-28 09:23:45 UTC (rev 3653)
+++ trunk/MonoRail/TestSiteBrail/Views/home/nullableProperties.brail 2007-03-28 20:13:01 UTC (rev 3654)
@@ -2,7 +2,7 @@
<html>
<h1><?brail
for element in list:
- output IgnoreNull(element).Foo
+ output IgnoreNull(element).Bar
end
?></h1>
</html>
\ No newline at end of file
Added:
/trunk/MonoRail/TestSiteBrail/Views/resourced/
indexingResources.brail
Modified:
/trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
ResourceTestCase.cs
/trunk/MonoRail/Castle.MonoRail.Views.Brail/
ResourceToDuck.cs
/trunk/MonoRail/TestSiteBrail/
TestSiteBrail.csproj
/trunk/MonoRail/TestSiteBrail/Controllers/
ResourcedController.cs
Log:
Allowing indexing into resources in Brail.
resx['testKey'], etc.
File Changes:
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail/
=======================================================
File [modified]: ResourceToDuck.cs
Delta lines: +9 -0
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail/ResourceToDuck.cs 2007-03-28 20:13:01 UTC (rev 3654)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail/ResourceToDuck.cs 2007-03-28 20:58:51 UTC (rev 3655)
@@ -36,6 +36,10 @@
public object QuackGet(string name, object[] parameters)
{
+ if(IsStringIndexer(name, parameters))
+ {
+ name = (string) parameters[0];
+ }
object val = resource.GetObject(name);
if(val==null)
{
@@ -44,6 +48,11 @@
return val;
}
+ private static bool IsStringIndexer(string name, object[] parameters)
+ {
+ return name.Length==0 && parameters.Length==1 && parameters[0] is string;
+ }
+
public object QuackSet(string name, object[] parameters, object value)
{
throw new RailsException("You cannnot set resource "+name);
Directory: /trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/
=============================================================
File [modified]: ResourceTestCase.cs
Delta lines: +14 -4
===================================================================
--- trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/ResourceTestCase.cs 2007-03-28 20:13:01 UTC (rev 3654)
+++ trunk/MonoRail/Castle.MonoRail.Views.Brail.Tests/ResourceTestCase.cs 2007-03-28 20:58:51 UTC (rev 3655)
@@ -14,8 +14,8 @@
namespace Castle.MonoRail.Views.Brail.Tests
{
- using System.Threading;
- using Castle.MonoRail.Framework.Tests;
+ using System.Threading;
+ using Castle.MonoRail.Framework.Tests;
using NUnit.Framework;
[TestFixture]
@@ -24,11 +24,21 @@
[Test]
public void GetResources()
{
- Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
- Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
+ Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
string expected = "testValue";
DoGet("resourced/getresources.rails");
AssertReplyEqualTo(expected);
}
+
+ [Test]
+ public void GetIndexedResources()
+ {
+ Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
+ string expected = "testValue";
+ DoGet("resourced/indexingResources.rails");
+ AssertReplyEqualTo(expected);
+ }
}
}
Directory: /trunk/MonoRail/TestSiteBrail/Controllers/
=====================================================
File [modified]: ResourcedController.cs
Delta lines: +4 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Controllers/ResourcedController.cs 2007-03-28 20:13:01 UTC (rev 3654)
+++ trunk/MonoRail/TestSiteBrail/Controllers/ResourcedController.cs 2007-03-28 20:58:51 UTC (rev 3655)
@@ -24,6 +24,10 @@
{
}
+ public void IndexingResources()
+ {
+
+ }
}
}
Directory: /trunk/MonoRail/TestSiteBrail/
=========================================
File [modified]: TestSiteBrail.csproj
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 20:13:01 UTC (rev 3654)
+++ trunk/MonoRail/TestSiteBrail/TestSiteBrail.csproj 2007-03-28 20:58:51 UTC (rev 3655)
@@ -154,6 +154,7 @@
<None Include="Views\jsgeneration\replacehtmlwithpartial.brailjs" />
<None Include="Views\jsgeneration\visualeffect.brailjs" />
<None Include="Views\jsgeneration\_partial1.brail" />
+ <None Include="Views\resourced\indexingResources.brail" />
</ItemGroup>
<ItemGroup>
<Reference Include="Boo.Lang, Version=1.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67, processorArchitecture=MSIL">
Directory: /trunk/MonoRail/TestSiteBrail/Views/resourced/
=========================================================
File [added]: indexingResources.brail
Delta lines: +1 -0
===================================================================
--- trunk/MonoRail/TestSiteBrail/Views/resourced/indexingResources.brail (rev 0)
+++ trunk/MonoRail/TestSiteBrail/Views/resourced/indexingResources.brail 2007-03-28 20:58:51 UTC (rev 3655)
@@ -0,0 +1 @@
+<% output resx['testKey'] %>