tale/util

Values

pub fn absolute_url(base_url: String, path: String) -> String

Build an absolute URL using the configured base URL and a site path. Paths starting with a scheme (e.g. https://) are returned untouched.

pub fn describe_runtime_error(err: error.RuntimeError) -> String
pub fn describe_tokenizer_error(
  err: error.TokenizerError,
) -> String
pub fn describe_toml_error(err: tom.ParseError) -> String

TOML Errors description

pub fn get_bool_or(
  doc: dict.Dict(String, tom.Toml),
  key: List(String),
  fallback: Bool,
) -> Bool

get bool or

pub fn get_string_list_or(
  doc: dict.Dict(String, tom.Toml),
  key: List(String),
  fallback: List(String),
) -> List(String)

Get string list

pub fn get_string_or(
  doc: dict.Dict(String, tom.Toml),
  key: List(String),
  fallback: String,
) -> String

get string or

pub fn normalize_base_url(value: String) -> String

Normalize the configured base URL so that joining paths is predictable.

pub fn optional_int(
  result: Result(Int, tom.GetError),
) -> option.Option(Int)
pub fn optional_string(
  result: Result(String, tom.GetError),
) -> option.Option(String)

Optional string

pub fn slugify(value: String) -> String
Search Document