This commit is contained in:
Adam Fowler
2021-03-19 17:49:02 +00:00
parent 66cbb25e16
commit 3c50d1c15c
4 changed files with 15 additions and 7 deletions

View File

@@ -1,17 +1,17 @@
/// Objects that can have a methods run on them. Mustache methods are specific to this implementation
/// Objects that can have a transforms run on them. Mustache transforms are specific to this implementation
/// of Mustache. They allow you to process objects before they are rendered.
///
/// The syntax for applying methods is `{{method(variable)}}`. Methods can be applied to both
/// variables and sections.
/// The syntax for applying transforms is `{{method(variable)}}`. Transforms can be applied to both
/// variables, sections and inverted sections.
///
/// A simple example would be ensuring a string is lowercase.
/// ```
/// {{lowercased(myString)}}
/// ```
/// If applying a method to a sequence then the closing element of the sequence should not include the
/// method name eg
/// If applying a transform to a sequence then the closing element of the sequence should include the
/// transform name eg
/// ```
/// {{#reversed(sequence)}}{{.}}{{\sequence}}
/// {{#reversed(sequence)}}{{.}}{{\reversed(sequence)}}
/// ```
public protocol HBMustacheTransformable {
func transform(_ name: String) -> Any?