Literature.StaticPages.Helpers (literature v0.4.17)

Provides helper functions for the static pages generator in Literature.

Summary

Types

async_opt()

@type async_opt() ::
  {:timeout, timeout()}
  | {:ordered, boolean()}
  | {:max_concurrency, integer()}
  | {:flatten, boolean()}

async_task()

@type async_task() :: {module(), atom(), [any()]}

Functions

async!(enum, fun, opts \\ [])

@spec async!(Enumerable.t(), (term() -> term()), [async_opt()]) :: [term()]

Wrapper around Task.async_stream/3 to returns only the result of the task

check_for_template!(module, template)

@spec check_for_template!(module(), atom()) :: :ok

Checks if the given module has the specified template function. Raises an error if the template is not found.

format_result(error, publication_slug, file_path)

@spec format_result(
  :ok | {:ok, tuple()} | {:error, term()},
  String.t(),
  String.t()
) :: :ok | {:ok, list()}

get_author!(author_slug, publication_slug)

@spec get_author!(String.t(), String.t()) :: Literature.Author.t()

get_post!(post_slug, publication_slug)

@spec get_post!(String.t(), String.t()) :: Literature.Post.t()

get_publication!(publication_slug)

@spec get_publication!(String.t()) :: Literature.Publication.t()

get_tag!(tag_slug, publication_slug)

@spec get_tag!(String.t(), String.t()) :: Literature.Tag.t()

list_authors(publication_slug, params \\ %{})

list_public_tags(publication_slug, params \\ %{})

list_published_posts(publication_slug, params \\ %{})

paginate_published_posts(publication_slug, page, page_size, params \\ %{})

@spec paginate_published_posts(String.t(), integer(), integer(), map()) ::
  Literature.Pagination.Page.t()