Example #1
0
        protected override void VisitAttribute(DomAttribute attribute)
        {
            string parent = stack.Peek();

            CurrentOutput.WriteLine("{0}.Attribute(\"{1}\", \"{2}\");",
                                    parent,
                                    CodeUtility.Escape(attribute.Name),
                                    CodeUtility.Escape(attribute.Value));
        }
Example #2
0
        protected override void VisitText(HxlTextElement element)
        {
            // These should have been converted to render islands, BUT there are a few
            // cases where we want to keep an object:
            // - parent is retained (easier to work with)
            // - only writing a space or tab (no need for the overhead)
            string parent = stack.Peek();

            CurrentOutput.WriteLine("{0}.AppendText(\"{1}\");", parent, CodeUtility.Escape(element.Data));
        }
Example #3
0
        void IHxlTemplateEmitter.EmitLiteral(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            sb.AppendSeparator(", ");
            sb.Append("\"" + CodeUtility.Escape(text) + "\"");
        }
Example #4
0
        protected override void VisitConstantExpression(ConstantExpression expression)
        {
            var str = expression.Value as string;

            if (str != null)
            {
                Output.Write("\"{0}\"", CodeUtility.Escape(str));
                return;
            }

            base.VisitConstantExpression(expression);
        }
Example #5
0
        protected override void VisitText(DomText text)
        {
            string parent = stack.Peek();

            CurrentOutput.WriteLine("{0}.AppendText(\"{1}\");", parent, CodeUtility.Escape(text.Data));
        }
 public IEnumerable <string> Start(HxlTextElement e)
 {
     yield return(string.Format(
                      "__self.Write(\"{0}\");", CodeUtility.Escape(e.Data)));
 }