View Source Idmlx.StyleCreator.ParagraphStyleCreator (idmlx v0.2.1)

Module responsible for creating Paragraph Style XML blocks for InDesign IDML documents.

This module provides functions to create and customize paragraph styles with attributes such as alignment, indentation, spacing, and various text formatting options.

Summary

Functions

Applies the style options to the base attributes map.

Creates a new paragraph style with the given name and options.

Creates an inner Properties element containing complex properties for a paragraph style.

Formats a paragraph style element with potential inner Properties element.

Functions

apply_style_options(attrs, options)

Applies the style options to the base attributes map.

create(name, options \\ %{})

Creates a new paragraph style with the given name and options.

Options

  • :font - Font name to use (string)
  • :font_style - Font style such as "Regular", "Bold", "Italic", etc. (string)
  • :point_size - Text size in points (number)
  • :fill_color - Text color name or RGB/CMYK values
  • :justification - Paragraph alignment like "LeftAlign", "CenterAlign", "RightAlign", "FullyJustified" (string)
  • :space_before - Space before paragraph (number)
  • :space_after - Space after paragraph (number)
  • :left_indent - Left indent of paragraph (number)
  • :right_indent - Right indent of paragraph (number)
  • :first_line_indent - First line indent (number)
  • :auto_leading - Auto leading percentage (number, typically 120 for 120%)
  • :next_style - The style to apply to the next paragraph (string)
  • :imported - Whether the style is imported (boolean)
  • :style_unique_id - Unique ID for the style (string, generated if not provided)
  • :based_on - The parent style this style inherits from (string)
  • Any character style attributes or other paragraph attributes defined in the schema

Examples

iex> Idmlx.StyleCreator.ParagraphStyleCreator.create("Body Text", %{
...>   font: "Minion Pro",
...>   point_size: 12,
...>   justification: "LeftAlign",
...>   space_after: 12,
...>   left_indent: 0,
...>   first_line_indent: 18
...> })

create_properties_element(options)

Creates an inner Properties element containing complex properties for a paragraph style.

format_style_with_properties(style_element, options)

Formats a paragraph style element with potential inner Properties element.