/// <summary>
 ///		Adds a new <see cref="PartialDocumentItem"/> and enters it.
 /// </summary>
 public static MorestachioDocumentFluentApi AddPartial(this MorestachioDocumentFluentApi api,
                                                       string name,
                                                       Func <MorestachioDocumentFluentApi, MorestachioDocumentFluentApi> factory)
 {
     return(api.AddChild(builder => new PartialDocumentItem(name,
                                                            factory(new MorestachioDocumentFluentApi(new MorestachioDocumentInfo(api.Context.Options,
                                                                                                                                 new MorestachioDocument()))).Context.RootNode.Item)));
 }
Ejemplo n.º 2
0
 /// <summary>
 ///		Adds a new <see cref="PartialDocumentItem"/> and enters it.
 /// </summary>
 public static MorestachioDocumentFluentApi AddPartial(this MorestachioDocumentFluentApi api,
                                                       string name,
                                                       Func <MorestachioDocumentFluentApi, MorestachioDocumentFluentApi> factory)
 {
     return(api.AddChild(builder => new PartialDocumentItem(CharacterLocation.Unknown, name, Enumerable.Empty <ITokenOption>())
     {
         Children =
         {
             factory(new MorestachioDocumentFluentApi(new MorestachioDocumentInfo(api.Context.Options,
                                                                                  new MorestachioDocument()))).Context.RootNode.Item
         }
     }));
 }
 /// <summary>
 ///		Adds a new <see cref="ElseExpressionScopeDocumentItem"/> and enters it.
 /// </summary>
 public static MorestachioDocumentFluentApi AddGlobalVariable(this MorestachioDocumentFluentApi api,
                                                              string name,
                                                              Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition)
 {
     return(api.AddChild(builder => new EvaluateVariableDocumentItem(name, condition(builder).Compile())));
 }
 /// <summary>
 ///		Adds a new <see cref="ContentDocumentItem"/>.
 /// </summary>
 public static MorestachioDocumentFluentApi AddContent(this MorestachioDocumentFluentApi api, string content)
 {
     return(api.AddChild(f => new ContentDocumentItem(content)));
 }
 /// <summary>
 ///		Adds a new <see cref="TextEditDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddTextModification(this MorestachioDocumentFluentApi api,
                                                                ITextOperation textOperation)
 {
     return(api.AddChild(builder => new TextEditDocumentItem(textOperation)));
 }
 /// <summary>
 ///		Adds a new <see cref="RenderPartialDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddInclude(this MorestachioDocumentFluentApi api,
                                                       string name,
                                                       Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition = null)
 {
     return(api.AddChild(builder => new RenderPartialDocumentItem(name, condition?.Invoke(builder).Compile())));
 }
 /// <summary>
 ///		Adds a new <see cref="PathDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddPath(this MorestachioDocumentFluentApi api,
                                                    Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition,
                                                    bool escapeValue = false)
 {
     return(api.AddChild(builder => new PathDocumentItem(condition(builder).Compile(), escapeValue)));
 }
Ejemplo n.º 8
0
 /// <summary>
 ///		Adds a new <see cref="ElseExpressionScopeDocumentItem"/> and enters it.
 /// </summary>
 public static MorestachioDocumentFluentApi AddGlobalVariable(this MorestachioDocumentFluentApi api,
                                                              string name,
                                                              Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition)
 {
     return(api.AddChild(builder => new EvaluateVariableDocumentItem(CharacterLocation.Unknown, name, condition(builder).Compile(), Enumerable.Empty <ITokenOption>())));
 }
Ejemplo n.º 9
0
 /// <summary>
 ///		Adds a new <see cref="ContentDocumentItem"/>.
 /// </summary>
 public static MorestachioDocumentFluentApi AddContent(this MorestachioDocumentFluentApi api, string content)
 {
     return(api.AddChild(f => new ContentDocumentItem(CharacterLocation.Unknown, content, Enumerable.Empty <ITokenOption>())));
 }
Ejemplo n.º 10
0
 /// <summary>
 ///		Adds a new <see cref="TextEditDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddTextModification(this MorestachioDocumentFluentApi api,
                                                                ITextOperation textOperation)
 {
     return(api.AddChild(builder => new TextEditDocumentItem(CharacterLocation.Unknown, textOperation, EmbeddedInstructionOrigin.Self, Enumerable.Empty <ITokenOption>())));
 }
Ejemplo n.º 11
0
 /// <summary>
 ///		Adds a new <see cref="RenderPartialDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddInclude(this MorestachioDocumentFluentApi api,
                                                       string name,
                                                       Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition = null)
 {
     return(api.AddChild(builder => new RenderPartialDocumentItem(CharacterLocation.Unknown, name, condition?.Invoke(builder).Compile(), Enumerable.Empty <ITokenOption>())));
 }
Ejemplo n.º 12
0
 /// <summary>
 ///		Adds a new <see cref="PathDocumentItem"/>
 /// </summary>
 public static MorestachioDocumentFluentApi AddPath(this MorestachioDocumentFluentApi api,
                                                    Func <MorestachioExpressionBuilderBaseRootApi, MorestachioExpressionBuilder> condition,
                                                    bool escapeValue = true)
 {
     return(api.AddChild(builder => new PathDocumentItem(CharacterLocation.Unknown, condition(builder).Compile(), escapeValue, Enumerable.Empty <ITokenOption>())));
 }