Jade.Parser.Nodes.ExpressionString.setEscape C# (CSharp) Method

setEscape() public method

public setEscape ( bool escape ) : void
escape bool
return void
        public void setEscape(bool escape)
        {
            this.escape = escape;
        }

Usage Example

Esempio n. 1
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;
        }