Class: Markbridge::AST::Details

Inherits:
Element show all
Defined in:
lib/markbridge/ast/details.rb

Overview

Represents a Discourse [details=…]… collapsible section.

Carries a title string (used as the summary text when the block renders) and any child nodes.

Examples:

block = AST::Details.new(title: "Show more")
block << AST::Text.new("Hidden body")

Instance Attribute Summary collapse

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#<<, #descendants, #each_descendant, #replace_child

Constructor Details

#initialize(title: nil) ⇒ Details

Returns a new instance of Details.

Parameters:

  • title (String, nil) (defaults to: nil)

    optional summary text



18
19
20
21
# File 'lib/markbridge/ast/details.rb', line 18

def initialize(title: nil)
  super()
  @title = title
end

Instance Attribute Details

#titleString? (readonly)

Returns the summary / collapsed-state label.

Returns:

  • (String, nil)

    the summary / collapsed-state label



15
16
17
# File 'lib/markbridge/ast/details.rb', line 15

def title
  @title
end