/// <summary> /// Creates a new <tt>Template</tt> object from liquid source code /// </summary> /// <param name="source"></param> /// <returns></returns> public static Template Parse(string source, IRenderableFactory renderableFactory = null) { Template template = new Template(); template.ParseInternal(source, renderableFactory); return(template); }
/// <summary> /// Parse source code. /// Returns self for easy chaining /// </summary> /// <param name="source">The source code.</param> /// <returns>The template.</returns> internal Template ParseInternal(string source, IRenderableFactory renderableFactory = null) { source = DotLiquid.Tags.Literal.FromShortHand(source); source = DotLiquid.Tags.Comment.FromShortHand(source); this.Root = new Document(renderableFactory); this.Root.Initialize(tagName: null, markup: null, tokens: Template.Tokenize(source)); return(this); }
/// <summary> /// Sets the <see cref="RenderableFactory"/> of the block to passed in <see cref="IRenderableFactory"/> /// </summary> /// <param name="renderableFactory"></param> public void SetRenderableFactory(IRenderableFactory renderableFactory) { RenderableFactory = renderableFactory ?? _DefaultRenderableFactory; }
/// <summary> /// Constructor that takes <see cref="IRenderableFactory"/> param to pass through to block parsing /// </summary> /// <param name="renderableFactory"></param> public Document(IRenderableFactory renderableFactory) : base(renderableFactory) { }
/// <summary> /// Constructor that takes <see cref="IRenderableFactory"/> param to pass through to block parsing /// </summary> public Block(IRenderableFactory renderableFactory) { SetRenderableFactory(renderableFactory); }