示例#1
0
        /// <summary>
        /// Replace the default Fluid comment block to allow embedded tags.
        /// </summary>
        private void RegisterLavaCaptureTag()
        {
            var captureTag = Identifier
                             .AndSkip(TagEnd)
                             .And(AnyTagsList)
                             .AndSkip(CreateTag("endcapture").ElseError($"'{{% endcapture %}}' was expected"))
                             .Then <Statement>(x => new CaptureStatement(x.Item1, x.Item2))
                             .ElseError("Invalid 'capture' tag");

            RegisteredTags["capture"] = captureTag;
        }
示例#2
0
 private void DefineLavaElementParsers()
 {
     // Define a parser for a named argument list separated by spaces in the form:
     // [name1:]value1 [name2:]value2 ...
     // This parser can also return an empty argument list.
     LavaArgumentsListParser = OneOf(LavaTokenEnd.Then(x => new List <FilterArgument>()),
                                     Separated(Space,
                                               OneOf(
                                                   Identifier.AndSkip(Colon).And(Primary).Then(x => new FilterArgument(x.Item1, x.Item2)),
                                                   Primary.Then(x => new FilterArgument(null, x))
                                                   )));
 }