Podium.Text (Podium v0.3.0)

Copy Markdown View Source

Text normalization and paragraph XML generation.

Converts various text input formats (plain strings, rich text lists) into a canonical paragraph structure, then renders as DrawingML <a:p> elements.

Summary

Functions

Collects all unique hyperlink URLs from normalized paragraphs.

Collects all slide jump target refs from normalized paragraphs. Returns a list of target slide refs.

Normalizes text input into a canonical list of paragraph maps.

Generates the XML for a list of normalized paragraphs (the <a:p> elements). Optionally accepts a hyperlink_rids map of %{url => rId} for resolving hyperlinks.

Functions

collect_slide_jumps(paragraphs)

@spec collect_slide_jumps([map()]) :: [reference()]

Collects all slide jump target refs from normalized paragraphs. Returns a list of target slide refs.

normalize(text, opts \\ [])

@spec normalize(
  Podium.rich_text(),
  keyword()
) :: [map()]

Normalizes text input into a canonical list of paragraph maps.

Accepts:

  • A plain string: "Hello"
  • A list of paragraphs where each paragraph is:
    • A list of runs: [{"bold text", bold: true}, "plain"]
    • A {runs, para_opts} tuple: {[{"Title", bold: true}], alignment: :center}

paragraphs_xml(paragraphs, hyperlink_rids \\ %{})

@spec paragraphs_xml([map()], map()) :: String.t()

Generates the XML for a list of normalized paragraphs (the <a:p> elements). Optionally accepts a hyperlink_rids map of %{url => rId} for resolving hyperlinks.