public
Created

Java Unified Expression Language uses the same ${...} syntax as SDL Tridion Template Expression Language. Work around this by writing your JUEL as $[...] in your Dreamweaver TBBs and use this TBB in your page template to convert the resultant output.

  • Download Gist
ConvertOutputToJavaUnifiedExpressionLanguage.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
using System.Text.RegularExpressions;
using Tridion.ContentManager.Templating;
using Tridion.ContentManager.Templating.Assembly;
 
namespace SDLTridion.Templating.Example
{
/// <summary>
/// Java Unified Expression Language uses the same ${...} syntax as
/// SDL Tridion Template Expression Language. Work around this by
/// writing your JUEL as $[...] in your Dreamweaver TBBs and use this
/// TBB in your page template to convert the resultant output.
/// </summary>
[TcmTemplateTitle("Convert Output to Java Unified Expression Language")]
class ConvertOutputToJavaUnifiedExpressionLanguage : ITemplate
{
public void Transform(Engine engine, Package package)
{
Item outputItem = package.GetByName(Package.OutputName);
 
string output = outputItem.GetAsString();
 
output = Regex.Replace(output, @"\$\[(.*?)\]", @"${$1}");
 
outputItem.SetAsString(output);
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.