private MockFileProvider GetMockFileProvider()
        {
            var fileProvider = new MockFileProvider();

            // Add a lava template that references merge fields from the outer template.
            var contactDetailsTemplate = @"
Mobile: {{ mobilePhone }}
Home: {{ homePhone }} 
Work: {{ workPhone }}
Email: {{ email }}
";

            fileProvider.Add("_contact.lava", contactDetailsTemplate);

            // This template contains the Lava-specific keyword "elseif" that is not recognized as a Liquid keyword.
            var lavaSyntaxTemplate = @"
{% assign speed = 50 %}
{% if speed > 70 -%}
Fast
{% elseif speed > 30 -%}
Moderate
{% else -%}
Slow
{% endif -%}
";

            fileProvider.Add("_lavasyntax.lava", lavaSyntaxTemplate);

            // Add a lava template that assigns a variable.
            var assignTemplate = @"
{% assign a = 'b' %}
Included 'a' = {{ a }}
";

            fileProvider.Add("_assign.lava", assignTemplate);

            return(fileProvider);
        }
Exemple #2
0
        private MockFileProvider GetFileProviderWithComments()
        {
            var fileProvider = new MockFileProvider();

            // Add a lava template that includes Lava-specific comments.
            var commentsTemplate = @"
Line 1<br>
//- Lava single line comment
Line 2<br>
/- Lava multi-line
   comment -/
Line 3<br>
{%- comment -%} Liquid comment {%- endcomment -%}
Line 4<br>
";

            fileProvider.Add("_comments.lava", commentsTemplate);

            return(fileProvider);
        }