View Source BUPE.Item (BUPE v0.6.1)

The Item element definition.

Each Item element represents a Publication Resource.

Summary

Functions

Convert a given path into a BUPE.Item struct.

Normalize the given BUPE.Item struct.

Types

@type t() :: %BUPE.Item{
  description: nil | String.t(),
  duration: nil | String.t(),
  fallback: nil | String.t(),
  href: String.t(),
  id: nil | String.t(),
  media_overlay: nil | String.t(),
  media_type: nil | String.t(),
  properties: nil | String.t()
}

Functions

@spec from_string(binary()) :: t()

Convert a given path into a BUPE.Item struct.

Examples

iex> BUPE.Item.from_string("book/bacon.xhtml")
#=> %BUPE.Item{
  description: "bacon",
  duration: nil,
  fallback: nil,
  href: "book/bacon.xhtml",
  id: "i-fddafede-7628-4cc9-b7e9-4a653cd2fef3",
  media_overlay: nil,
  media_type: "application/xhtml+xml",
  properties: nil
}
@spec normalize(t()) :: t()

Normalize the given BUPE.Item struct.

Examples

iex> BUPE.Item.normalize(%BUPE.Item{
...>   id: "ode-to-bacon",
...>   href: "book/bacon.xhtml",
...>   description: "Ode to Bacon"
...> })
%BUPE.Item{
  description: "Ode to Bacon",
  duration: nil,
  fallback: nil,
  href: "book/bacon.xhtml",
  id: "ode-to-bacon",
  media_overlay: nil,
  media_type: "application/xhtml+xml",
  properties: nil
}