private object RenderInternal(Context context) { if (Name == null) { return(null); } object output = context[Name]; foreach (var filter in Filters.ToList()) { List <object> filterArgs = filter.Arguments.Select(a => context[a]).ToList(); try { filterArgs.Insert(0, output); output = context.Invoke(filter.Name, filterArgs); } catch (FilterNotFoundException ex) { throw new FilterNotFoundException(string.Format(Liquid.ResourceManager.GetString("VariableFilterNotFoundException"), filter.Name, _markup.Trim()), ex); } } ; if (output is IValueTypeConvertible valueTypeConvertibleOutput) { output = valueTypeConvertibleOutput.ConvertToValueType(); } return(output); }
private object RenderInternal(Context context) { if (Name == null) return null; object output = context[Name]; Filters.ToList().ForEach(filter => { List<object> filterArgs = filter.Arguments.Select(a => context[a]).ToList(); try { filterArgs.Insert(0, output); output = context.Invoke(filter.Name, filterArgs); } catch (FilterNotFoundException ex) { throw new FilterNotFoundException(string.Format("Error - filter '{0}' in '{1}' could not be found.", filter.Name, _markup.Trim()), ex); } }); return output; }