Combinators
Provides combinators to describe the expected structure of a specific directive.
Type members
Classlikes
Value members
Concrete methods
A combinator that captures all attributes in a directive declaration.
A combinator that captures all attributes in a directive declaration.
This is useful when a directive implementation allows the use of any arbitrary attribute name, but leaves the burden of validation to the implementor of the directive. This part does not provide automatic error handling for missing required attributes for example.
Specifies a required attribute from the positional attribute section of the directive.
Specifies a required attribute from the positional attribute section of the directive.
- Value parameters:
- position
the position within the attribute list
- Returns:
a directive part that can be combined with further parts
Specifies a required attribute from the HOCON section of the directive.
Specifies a required attribute from the HOCON section of the directive.
- Value parameters:
- key
the key that must be used in markup or templates
- Returns:
a directive part that can be combined with further parts
Indicates that access to the document cursor is required. This may be required if the directive relies on information from the document structure, its title or the parent tree it is contained in.
Indicates that access to the document cursor is required. This may be required if the directive relies on information from the document structure, its title or the parent tree it is contained in.
Specifies an empty directive that does not accept any attributes or body elements.
Specifies an empty directive that does not accept any attributes or body elements.
- Value parameters:
- result
the fixed result each empty directive will produce
- Returns:
a directive part that usually won't be combined with other parts
Specifies a required body part parsed as spans or blocks, depending on the type of directive.
Specifies a required body part parsed as spans or blocks, depending on the type of directive.
- Returns:
a directive part that can be combined with further parts
Specifies a required body part with a custom parser.
Specifies a required body part with a custom parser.
The provided parser factory function has to accept a parameter for an instance providing access to the default parser for blocks and spans with all user and theme extensions installed.
This is useful for situations where some custom parsing logic has to be combined with the standard block/span parsing rules.
This is a fairly rare requirement, and most likely used the zero-param parsedBody
method
will suffice in most cases.
- Returns:
a directive part that can be combined with further parts
A combinator that captures all positional attributes in a directive declaration.
A combinator that captures all positional attributes in a directive declaration.
This is useful when the positional attributes represent a flexible, comma-separated list of values.
Using as
on the directive decodes '''all''' attributes as the same type. To decode with different
types, use the combinators for individual positional attributes, e.g. attribute(0)
.
Specifies a required body part.
Specifies a required body part.
- Returns:
a directive part that can be combined with further parts
Specifies a required body part divided by separator directives.
Specifies a required body part divided by separator directives.
It is recommended that all separators extend a sealed trait, if the directive supports more than one separator kind. The separators need to be immediate children in the body element of the parent directive.
- Value parameters:
- separators
all separator directives accepted as children of this directive.
- Returns:
a directive part that can be combined with further parts
Indicates that access to the source of the directive is required.
This may be required if the directive needs to produce instances of InvalidElement
for error scenarios,
which requires passing the source.
Indicates that access to the source of the directive is required.
This may be required if the directive needs to produce instances of InvalidElement
for error scenarios,
which requires passing the source.
This should normally be a rare requirement, as it is more convenient to use evalMap
on the directive
builder and pass simple strings describing any error and let the library insert the corresponding source.