public void Parse(ParseContext context) { var templateString = context.TemplateString; var template = templateString.Template; var builder = new StringBuilder(template); var variables = templateString.Variables; var parsed = false; foreach (var variable in variables) { var variableValue = GetVariableValue(context, variable); var replaceValue = TemplateUtilities.GetReplaceText(variable); if (template.IndexOf(replaceValue, StringComparison.OrdinalIgnoreCase) == -1) { continue; } parsed = true; builder.Replace(replaceValue, variableValue); } context.Result = parsed ? TemplateUtilities.Escaped(builder.ToString()) : template; }