NLdoc.Conversion.Reader.Docx.AST.Style (NLdoc.Conversion.Reader.Docx v1.1.2)

View Source

This module defines a struct that represents a style in a Word document.

Summary

Functions

Get the heading level of a heading style from its name (case-insensitive) The style must have type :heading.

Types

style_type()

@type style_type() ::
  :title
  | :heading
  | :paragraph
  | :blockquote
  | :inline_quote
  | :code
  | :definition_term
  | :definition

t()

@type t() :: %NLdoc.Conversion.Reader.Docx.AST.Style{
  based_on: String.t() | nil,
  id: String.t(),
  name: String.t(),
  type: style_type()
}

Functions

heading_level(arg1)

@spec heading_level(t()) :: integer() | nil

Get the heading level of a heading style from its name (case-insensitive) The style must have type :heading.

Examples

iex> alias NLdoc.Conversion.Reader.Docx.AST.Style
iex> Style.heading_level(%Style{id: "test", based_on: nil, type: :heading, name: "heading 1"})
1
iex> Style.heading_level(%Style{id: "test", based_on: nil, type: :heading, name: "heading 2"})
2
iex> Style.heading_level(%Style{id: "test", based_on: nil, type: :heading, name: "HeAdInG 3"})
3
iex> Style.heading_level(%Style{id: "test", based_on: nil, type: :paragraph, name: "heading 1"})
nil

is_blockquote(style)

(macro)

is_code(style)

(macro)

is_definition(style)

(macro)

is_definition_term(style)

(macro)

is_heading(style)

(macro)

is_inline_quote(style)

(macro)

is_paragraph(style)

(macro)

is_title(style)

(macro)