Class: Coradoc::AsciiDoc::Model::Inline::Span

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/asciidoc/model/inline/span.rb

Overview

Span inline element for applying styles to text in AsciiDoc documents.

Spans allow applying roles and custom attributes to inline text.

Examples:

Create a span with a role

span = Coradoc::AsciiDoc::Model::Inline::Span.new
span.text = "Important text"
span.role = "red"
span.to_adoc # => "[.red]#Important text#"

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Method Summary

Methods inherited from Base

#inline?

Methods inherited from Base

#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_adoc, #to_h, visit, #visit

Instance Attribute Details

#attributesCoradoc::AsciiDoc::Model::AttributeList? (readonly)

Returns Additional attributes.

Returns:



29
30
31
32
33
34
# File 'lib/coradoc/asciidoc/model/inline/span.rb', line 29

class Span < Base
  attribute :text, :string
  attribute :role, :string
  attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList
  attribute :unconstrained, :boolean, default: -> { false }
end

#roleString? (readonly)

Returns The CSS role to apply.

Returns:

  • (String, nil)

    The CSS role to apply



29
30
31
32
33
34
# File 'lib/coradoc/asciidoc/model/inline/span.rb', line 29

class Span < Base
  attribute :text, :string
  attribute :role, :string
  attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList
  attribute :unconstrained, :boolean, default: -> { false }
end

#textString (readonly)

Returns The text content.

Returns:

  • (String)

    The text content



29
30
31
32
33
34
# File 'lib/coradoc/asciidoc/model/inline/span.rb', line 29

class Span < Base
  attribute :text, :string
  attribute :role, :string
  attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList
  attribute :unconstrained, :boolean, default: -> { false }
end

#unconstrainedBoolean (readonly)

Returns Whether to use unconstrained formatting (default: false).

Returns:

  • (Boolean)

    Whether to use unconstrained formatting (default: false)



29
30
31
32
33
34
# File 'lib/coradoc/asciidoc/model/inline/span.rb', line 29

class Span < Base
  attribute :text, :string
  attribute :role, :string
  attribute :attributes, Coradoc::AsciiDoc::Model::AttributeList
  attribute :unconstrained, :boolean, default: -> { false }
end