Exemplo n.º 1
0
        private Object evaluateExpression(ExpressionString attribute, JadeModel model) //throws ExpressionException
        {
            String expression = ((ExpressionString)attribute).getValue();
            Object result     = ExpressionHandler.evaluateExpression(expression, model);

            if (result is ExpressionString)
            {
                return(evaluateExpression((ExpressionString)result, model));
            }
            return(result);
        }
Exemplo n.º 2
0
 //throws ExpressionException
 private Object evaluateExpression(ExpressionString attribute, JadeModel model)
 {
     String expression = ((ExpressionString)attribute).getValue();
     Object result = ExpressionHandler.evaluateExpression(expression, model);
     if (result is ExpressionString) {
         return evaluateExpression((ExpressionString)result, model);
     }
     return result;
 }
Exemplo n.º 3
0
        public static List<Object> prepareInterpolate(string str, bool xmlEscape)
        {
            int start = 0;
            var result = new List<Object>();

            foreach (Match matcher in interpolationPattern.Matches(str))
            {
                string before = str.Substring(start, matcher.Index - start);
                if (xmlEscape)
                {
                    before = escapeHTML(before);
                }
                result.Add(before);

                bool escape = matcher.Groups[1].Length < 1;
                string flag = matcher.Groups[2].Value;
                string code = matcher.Groups[3].Value;

                if (escape)
                {
                    string escapedExpression = matcher.Groups[0].Value.Substring(1);
                    if (xmlEscape)
                    {
                        escapedExpression = escapeHTML(escapedExpression);
                    }
                    result.Add(escapedExpression);
                }
                else
                {
                    ExpressionString expression = new ExpressionString(code);
                    if (flag.Equals("#"))
                    {
                        expression.setEscape(true);
                    }
                    result.Add(expression);
                }
                start = matcher.Index + matcher.Value.Length;
                var match = matcher.NextMatch();
            }
            string last = str.Substring(start);
            if (xmlEscape)
            {
                last = escapeHTML(last);
            }
            result.Add(last);

            return result;
        }