View Source Idmlx.Components.Styles behaviour (idmlx v0.2.0)

Provides functionality for parsing and working with InDesign styles.

This module handles:

  • Parsing styles from IDMS/IDML files
  • Managing different style types
  • Style inheritance resolution
  • Style collection management

Style Types

Supports three main categories:

  • Paragraph styles (text formatting)
  • Character styles (character-level formatting)
  • Object styles (shape and frame formatting)

Style Inheritance

Styles can inherit properties from parent styles using the based_on field. The module handles resolving inherited properties through the style hierarchy.

Summary

Callbacks

get_character_styles(t)

@callback get_character_styles(String.t()) :: [Idmlx.Components.Style.t()]

get_object_styles(t)

@callback get_object_styles(String.t()) :: [Idmlx.Components.Style.t()]

get_paragraph_styles(t)

@callback get_paragraph_styles(String.t()) :: [Idmlx.Components.Style.t()]

get_styles(t)

@callback get_styles(String.t()) :: [Idmlx.Components.Style.t()]

Functions

get_character_styles(file_path \\ "Resources/Styles.xml")

@spec get_character_styles(String.t()) :: [Idmlx.Components.Style.t()]

Gets character styles from a file.

Parameters

  • file_path: Path to the styles file (defaults to "Resources/Styles.xml")

Returns

List of character styles

get_object_styles(file_path \\ "Resources/Styles.xml")

@spec get_object_styles(String.t()) :: [Idmlx.Components.Style.t()]

Gets object styles from a file.

Parameters

  • file_path: Path to the styles file (defaults to "Resources/Styles.xml")

Returns

List of object styles

get_paragraph_styles(file_path \\ "Resources/Styles.xml")

@spec get_paragraph_styles(String.t()) :: [Idmlx.Components.Style.t()]

Gets paragraph styles from a file.

Parameters

  • file_path: Path to the styles file (defaults to "Resources/Styles.xml")

Returns

List of paragraph styles

get_styles(file_path \\ "Resources/Styles.xml")

@spec get_styles(String.t()) :: [Idmlx.Components.Style.t()]

Gets all styles from a file.

Parameters

  • file_path: Path to the styles file (defaults to "Resources/Styles.xml")

Returns

List of all styles (paragraph, character, and object styles)

Examples

iex> Idmlx.Components.Styles.get_styles("styles.xml")
[%Style{name: "ParagraphStyle/Body"}, %Style{name: "CharacterStyle/Bold"}]