Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
 /// <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;
 }
Esempio n. 4
0
 /// <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)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor that takes <see cref="IRenderableFactory"/> param to pass through to block parsing
 /// </summary>
 public Block(IRenderableFactory renderableFactory)
 {
     SetRenderableFactory(renderableFactory);
 }