MishkaCmsCore.Runtime.PageBuilder.LayoutSlot (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Whether a layout still renders the page it wraps.

A layout is not a page with a header on it: its whole job is to put something around @inner_content, the assign MishkaCmsCore.Runtime.Compilers.LayoutCompiler hands its render/2. Take that expression out and the layout compiles, saves and previews perfectly — and every page using it serves the layout's own chrome with the page's content missing. Nothing said so: the editor let the chip be deleted like any other node, the audit reported no blockers, and publishing went through.

So the question gets one answer, asked by the audit rail and again by the publish gate, and it is asked of the tree rather than of the text: @inner_content written inside a comment or a string is not a rendering of it, and {@inner_content}, <%= @inner_content %> and <%= render_slot(@inner_content) %> are all the same thing to the compiler.

See MishkaCmsCore.Runtime.PageBuilder.PageStarter, whose blank layout ships with the slot already in it for the same reason.

Summary

Functions

The assign a layout renders the page through.

Whether anything in tree evaluates @inner_content, hidden from visitors or not. With renders_inner_content?/1 false, true means the slot is inside a hidden element.

Whether tree renders @inner_content for a visitor: somewhere outside every element hidden from visitors (MishkaCmsCore.Runtime.PageBuilder.Visibility), which the layout compiler leaves out.

Functions

assign()

@spec assign() :: atom()

The assign a layout renders the page through.

holds_inner_content?(tree)

@spec holds_inner_content?(MishkaCmsCore.Runtime.PageBuilder.Tree.t()) :: boolean()

Whether anything in tree evaluates @inner_content, hidden from visitors or not. With renders_inner_content?/1 false, true means the slot is inside a hidden element.

renders_inner_content?(tree)

@spec renders_inner_content?(MishkaCmsCore.Runtime.PageBuilder.Tree.t()) :: boolean()

Whether tree renders @inner_content for a visitor: somewhere outside every element hidden from visitors (MishkaCmsCore.Runtime.PageBuilder.Visibility), which the layout compiler leaves out.

Total: an expression Elixir cannot read answers false rather than raising, because a template the compiler will reject is not one that renders the page either.