Skip to content
docsv0.1.0

MarkupCompilerInterface

Compiles authored XHTML-with-component-tags markup (e.g. `<milpa:autocomplete .../>`) into a single rendered {@see RenderResult} by resolving each component tag through a {@see \Milpa\Live\Contracts\Component\ComponentRegistryInterface} and its paired {@see ComponentRendererInterface}. This is the authoring-time seam: templates write component tags, not renderer calls.

MarkupCompilerInterface::compile()

abstract public function compile(string $markup, Milpa\Live\ValueObjects\ComponentContext $context): Milpa\Live\ValueObjects\RenderResult

Compiles markup that MUST contain exactly one root component element into that component's rendered output.

Parameters

Parameters of compile()
NameTypeDescription
$markupstring
$contextMilpa\Live\ValueObjects\ComponentContext

Throws

\RuntimeException If the markup is not valid XML, does not contain exactly one root component element, or names a component/renderer that is not registered.