scriptorium/renderer
The renderer’s job is to render compiled content into HTML. By default this means Lustre elements that can be later stringified.
Types
Helper struct to pass all the used views to the rendering functions.
pub type Views {
Views(
base: fn(
@internal Element(Nil),
List(@internal Element(Nil)),
String,
) -> @internal Element(Nil),
meta: fn(views.PageType) -> List(@internal Element(Nil)),
single_post_full: fn(compiler.CompiledPost) -> @internal Element(
Nil,
),
page: fn(compiler.CompiledPage) -> @internal Element(Nil),
list_page: fn(views.ListInfo) -> @internal Element(Nil),
feed: fn(List(compiler.CompiledPost)) -> @internal Element(
Nil,
),
)
}
Constructors
-
Views( base: fn( @internal Element(Nil), List(@internal Element(Nil)), String, ) -> @internal Element(Nil), meta: fn(views.PageType) -> List(@internal Element(Nil)), single_post_full: fn(compiler.CompiledPost) -> @internal Element( Nil, ), page: fn(compiler.CompiledPage) -> @internal Element(Nil), list_page: fn(views.ListInfo) -> @internal Element(Nil), feed: fn(List(compiler.CompiledPost)) -> @internal Element(Nil), )
Arguments
- single_post_full
-
View for a single post rendered on its own.
Values
pub fn render(
db: database.Database,
compiled: compiler.CompileDatabase,
config: config.Configuration,
) -> database.RenderDatabase
Render the database and compiled content using the configuration.
pub fn render_pages(
db: database.Database,
compiled_pages: List(compiler.CompiledPage),
views: Views,
) -> List(database.RenderedPage)
pub fn render_posts(
db: database.Database,
post_contents: dict.Dict(bigi.BigInt, compiler.CompiledPost),
views: Views,
) -> List(database.RenderedSinglePost)