Skip to content

anonymous /ConvertOutputToJavaUnifiedExpressionLanguage.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.