Sablon.DOM.Relationships (sablon v0.4.4)

Copy Markdown View Source

Adds relationships to a .rels part.

Every document part has its own relationships file, and relationship ids are only unique within it - which is why an image reused across the body and a header needs one relationship per part.

Summary

Functions

Appends a relationship and returns its generated rId.

The markup used when a part has no relationships file yet.

Finds a relationship by attribute value, or returns nil.

The name of the relationships file belonging to entry_name.

Functions

add_relationship(document, rel_attr)

@spec add_relationship(Sablon.XML.Document.t(), Sablon.Props.t() | map() | keyword()) ::
  binary()

Appends a relationship and returns its generated rId.

file_template()

@spec file_template() :: binary()

The markup used when a part has no relationships file yet.

find_relationship_by(document, attribute, value)

@spec find_relationship_by(Sablon.XML.Document.t(), binary(), binary()) ::
  Sablon.XML.Node.t() | nil

Finds a relationship by attribute value, or returns nil.

rels_entry_name_for(entry_name)

@spec rels_entry_name_for(binary()) :: binary()

The name of the relationships file belonging to entry_name.

iex> Sablon.DOM.Relationships.rels_entry_name_for("word/document.xml")
"word/_rels/document.xml.rels"