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
Functions
Gets character styles from a file.
Gets object styles from a file.
Gets paragraph styles from a file.
Gets all styles from a file.
Callbacks
@callback get_character_styles(String.t()) :: [Idmlx.Components.Style.t()]
@callback get_object_styles(String.t()) :: [Idmlx.Components.Style.t()]
@callback get_paragraph_styles(String.t()) :: [Idmlx.Components.Style.t()]
@callback get_styles(String.t()) :: [Idmlx.Components.Style.t()]
Functions
@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
@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
@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
@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"}]