View Source CFSync.RichText (CFSync v0.16.1)

RichText recursive struct

RichText in Contentful is implemented as a tree of nodes. All nodes share a common structure and some of them have specific properties. Here I chosed to represent all nodes with a single struct for simplicity.

Link to this section Summary


Maps node recursively using the provided function.

Link to this section Types

@type marks() :: :bold | :italic | :underline | :code
@type node_types() ::
  | :paragraph
  | :heading_1
  | :heading_2
  | :heading_3
  | :heading_4
  | :heading_5
  | :heading_6
  | :ol_list
  | :ul_list
  | :list_item
  | :hr
  | :quote
  | :embedded_entry
  | :embedded_asset
  | :table
  | :table_row
  | :table_cell
  | :table_header_cell
  | :hyperlink
  | :entry_hyperlink
  | :asset_hyperlink
  | :embedded_entry_inline
  | :text
@type t() :: %CFSync.RichText{
  colspan: integer(),
  content: [t()],
  marks: [marks()],
  rowspan: integer(),
  target: nil | CFSync.Link.t(),
  type: node_types(),
  uri: nil | binary(),
  value: binary()

Link to this section Functions

@spec map(t(), function()) :: t()

Maps node recursively using the provided function.

The provided function should accept a node and return a new node.

Link to this function

new(data, store, locale)

View Source
@spec new(:empty | map(),, atom()) :: t()