当前位置: 首页>>代码示例>>C#>>正文


C# Factory.MetaCode方法代码示例

本文整理汇总了C#中Factory.MetaCode方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.MetaCode方法的具体用法?C# Factory.MetaCode怎么用?C# Factory.MetaCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory.MetaCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanParseIfElseTag

		public void CanParseIfElseTag()
		{
			var factory = new Factory();

			ParserTest("{{#if condition}}True!{{else}}False!{{/if}}", factory.Document(
				factory.Tag("if",
					factory.TagElement("if",
						factory.MetaCode("{{", T.OpenTag),
						factory.MetaCode("#", T.Hash),
						factory.Expression(factory.Symbol("if", T.Keyword)),
						factory.WhiteSpace(1),
						factory.Parameter("condition"),
						factory.MetaCode("}}", T.CloseTag)
					),
					factory.Text("True!"),
					factory.TagElement("else",
						factory.MetaCode("{{", T.OpenTag),
						factory.Expression(factory.Symbol("else", T.Keyword)),
						factory.MetaCode("}}", T.CloseTag)
					),
					factory.Text("False!"),
					factory.TagElement("if",
						factory.MetaCode("{{", T.OpenTag),
						factory.MetaCode("/", T.Hash),
						factory.Expression(factory.Symbol("if", T.Keyword)),
						factory.MetaCode("}}", T.CloseTag)
					)
				)
			));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:30,代码来源:HandlebarsParserFacts.cs

示例2: CanParseExpressionTag

		public void CanParseExpressionTag()
		{
			var factory = new Factory();

			ParserTest("{{hello}}", factory.Document(
				factory.Expression(
					factory.MetaCode("{{", T.OpenTag),
					factory.Expression(
						factory.Symbol("hello", T.Identifier)
					),
					factory.MetaCode("}}", T.CloseTag)
				)
			));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:14,代码来源:HandlebarsParserFacts.cs

示例3: CanParseNegatedSection

		public void CanParseNegatedSection()
		{
			var factory = new Factory();

			var document = factory.Document(
			factory.Tag("person",
				factory.TagElement("person",
					factory.MetaCode("{{", T.OpenTag),
					factory.MetaCode("^", T.Negate),
					factory.Expression(factory.Symbol("person", T.Identifier)),
					factory.MetaCode("}}", T.CloseTag)),
				factory.Text("Text"),
				factory.TagElement("person",
					factory.MetaCode("{{", T.OpenTag),
					factory.MetaCode("/", T.Slash),
					factory.Expression(factory.Symbol("person", T.Identifier)),
					factory.MetaCode("}}", T.CloseTag))));

			ParserTest("{{^person}}Text{{/person}}", document);
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:20,代码来源:HandlebarsParserFacts.cs

示例4: CanParseEscapedExpressionUsingAmpersand

		public void CanParseEscapedExpressionUsingAmpersand()
		{
			var factory = new Factory();

			ParserTest("{{&person.name}}", factory.Document(
				factory.Expression(
					factory.MetaCode("{{", T.OpenTag),
					factory.MetaCode("&", T.Ampersand),
					factory.Span(SpanKind.Expression,
						factory.Symbol("person", T.Identifier),
						factory.Symbol(".", T.Dot),
						factory.Symbol("name", T.Identifier)
					),
					factory.MetaCode("}}", T.CloseTag))
				));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:16,代码来源:HandlebarsParserFacts.cs

示例5: CanParseRootVariable

		public void CanParseRootVariable()
		{
			var factory = new Factory();

			ParserTest("{{@root.name}}", factory.Document(
				factory.Expression(
					factory.MetaCode("{{", T.OpenTag),
					factory.Span(SpanKind.Expression,
						factory.Symbol("@", T.At),
						factory.Symbol("root", T.Identifier),
						factory.Symbol(".", T.Dot),
						factory.Symbol("name", T.Identifier)
					),
					factory.MetaCode("}}", T.CloseTag))
				));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:16,代码来源:HandlebarsParserFacts.cs

示例6: CanParsePartialTag

		public void CanParsePartialTag()
		{
			var factory = new Factory();

			ParserTest("{{>body}}", factory.Document(
				factory.Partial(
					factory.MetaCode("{{", T.OpenTag),
					factory.MetaCode(">", T.RightArrow),
					factory.Span(SpanKind.Expression, factory.Symbol("body", T.Identifier)),
					factory.MetaCode("}}", T.CloseTag))
				));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:12,代码来源:HandlebarsParserFacts.cs

示例7: CanParseMultipleMappedParametersWithExpressions

		public void CanParseMultipleMappedParametersWithExpressions()
		{
			var factory = new Factory();

			var expected = factory.Document(
				factory.Tag("list",
					factory.TagElement("list",
						factory.MetaCode("{{", T.OpenTag),
						factory.MetaCode("#", T.Hash),
						factory.Expression(factory.Symbol("list", T.Identifier)),
						factory.WhiteSpace(1),
						factory.Parameter(
							factory.Symbol("model", T.Identifier),
							factory.Symbol(".", T.Dot),
							factory.Symbol("people", T.Identifier)
							),
						factory.WhiteSpace(1),
						factory.Map("class",
							() => new ISymbol[]
							      {
								      factory.Symbol("model", T.Identifier),
								      factory.Symbol(".", T.Dot),
								      factory.Symbol("cssClass", T.Identifier)
							      }),
						factory.WhiteSpace(1),
						factory.Map("age",
							() => new ISymbol[]
							      {
								      factory.Symbol(".", T.Dot),
								      factory.Symbol("/", T.Slash),
								      factory.Symbol("model", T.Identifier),
								      factory.Symbol(".", T.Dot),
								      factory.Symbol("ages", T.Identifier)
							      }
							),
						factory.MetaCode("}}", T.CloseTag)
						)
					)
				);

			ParserTest("{{#list model.people class=model.cssClass age=./model.ages}}", expected);
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:42,代码来源:HandlebarsParserFacts.cs

示例8: CanParseMultipleMappedParameters

		public void CanParseMultipleMappedParameters()
		{
			var factory = new Factory();

			ParserTest("{{#list people class=\"value\" age=10.5}}", factory.Document(
				factory.Tag("list",
					factory.TagElement("list",
						factory.MetaCode("{{", T.OpenTag),
						factory.MetaCode("#", T.Hash),
						factory.Expression(factory.Symbol("list", T.Identifier)),
						factory.WhiteSpace(1),
						factory.Parameter("people"),
						factory.WhiteSpace(1),
						factory.Map("class", "\"value\"", T.StringLiteral),
						factory.WhiteSpace(1),
						factory.Map("age", "10.5", T.RealLiteral),
						factory.MetaCode("}}", T.CloseTag)
					)
				)
			));
		}
开发者ID:furesoft,项目名称:FuManchu,代码行数:21,代码来源:HandlebarsParserFacts.cs


注:本文中的Factory.MetaCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。