Packages
arctic
9.0.4
11.0.10
11.0.9
11.0.8
11.0.7
11.0.6
11.0.6-z6
11.0.6-z5
11.0.6-z4
11.0.6-z3
11.0.6-z2
11.0.6-z1
11.0.6-gamma
11.0.6-delta
11.0.6-beta
11.0.6-alpha
11.0.5
11.0.4
11.0.3
11.0.2
11.0.1
11.0.0
11.0.0-alpha5
11.0.0-alpha4
11.0.0-alpha3
11.0.0-alpha2
11.0.0-alpha
10.0.1
10.0.0
10.0.0-alpha2
10.0.0-alpha
9.0.5
9.0.4
9.0.3
9.0.2
9.0.0
8.0.0
7.0.0
6.0.0
5.0.0
4.0.0
3.0.0
2.0.0
1.0.1
1.0.0
A friendly web framework for fast response times and a lightweight or serverless backend, written in Gleam!
Current section
Files
Jump to
Current section
Files
src/arctic@config.erl
-module(arctic@config).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([new/0, home_renderer/2, add_main_page/3, add_collection/2]).
-spec new() -> arctic:config().
new() ->
{config,
fun(_) ->
lustre@element@html:html(
[],
[lustre@element@html:head([], []),
lustre@element@html:body(
[],
[lustre@element:text(
<<"No renderer set up for home page"/utf8>>
)]
)]
)
end,
[],
[]}.
-spec home_renderer(
arctic:config(),
fun((list(arctic:processed_collection())) -> lustre@internals@vdom:element(nil))
) -> arctic:config().
home_renderer(Config, Renderer) ->
{config, Renderer, erlang:element(3, Config), erlang:element(4, Config)}.
-spec add_main_page(
arctic:config(),
binary(),
lustre@internals@vdom:element(nil)
) -> arctic:config().
add_main_page(Config, Id, Body) ->
{config,
erlang:element(2, Config),
[{raw_page, Id, Body} | erlang:element(3, Config)],
erlang:element(4, Config)}.
-spec add_collection(arctic:config(), arctic:collection()) -> arctic:config().
add_collection(Config, Collection) ->
{config,
erlang:element(2, Config),
erlang:element(3, Config),
[Collection | erlang:element(4, Config)]}.