public void transform_simple_attribute_noop()
        {
            var doc  = new HxlDocument();
            var attr = doc.CreateAttribute("class");

            attr.Value = "no expressions";
            var node = ConvertNode(attr);

            Assert.Same(attr, node);
        }
        internal static DomObject ConvertNode(DomObject attr)
        {
            var        __document   = new HxlDocument();
            DomElement root_article = __document.CreateElement("article");
            DomObject  root_article_hxlexpressionattribute = global::Carbonfrost.Commons.Hxl.HxlAttribute.Create("id", (__closure, __self__) => string.Concat((object)(__closure.Inside)));

            root_article.Append(root_article_hxlexpressionattribute);

            var conv = HxlCompilerConverter.ChooseConverter(attr);

            return(conv.Convert(attr, CSharpScriptGenerator.Instance));
        }
        public void transform_simple_attribute_expression_syntax()
        {
            var doc  = new HxlDocument();
            var attr = doc.CreateAttribute("class");

            attr.Value = "no $myExpressions";

            var expected = "myvar = global::Carbonfrost.Commons.Hxl.HxlAttribute.Create(\"class\", (__closure, __self__) => string.Concat((object) \"no \", (__closure.MyExpressions)));" + Environment.NewLine;
            var tw       = new StringWriter();

            ((HxlExpressionAttribute)ConvertNode(attr)).GetInitCode("myvar", null, tw);  // new IndentedTextWriter(tw, "    "));
            string text = tw.ToString();

            Assert.Equal(expected, text);
        }
 public void Optimize(HxlDocument template, IServiceProvider serviceProvider)
 {
 }
示例#5
0
 void IHxlCompilerProcessor.Optimize(HxlDocument template, IServiceProvider serviceProvider)
 {
 }