Class: Coradoc::Html::Drop::DefinitionItemDrop

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/html/drop/definition_item_drop.rb

Instance Attribute Summary

Attributes inherited from Base

#model

Instance Method Summary collapse

Methods inherited from Base

#id, #initialize, #template_type, #title, #to_liquid

Constructor Details

This class inherits a constructor from Coradoc::Html::Drop::Base

Instance Method Details

#definitionsObject



16
17
18
19
20
# File 'lib/coradoc/html/drop/definition_item_drop.rb', line 16

def definitions
  return [] unless @model.definitions

  @model.definitions.map { |d| content_to_liquid(d) }
end

#nestedObject



22
23
24
25
26
27
28
# File 'lib/coradoc/html/drop/definition_item_drop.rb', line 22

def nested
  nested_model = @model.nested
  return nil unless nested_model.is_a?(CoreModel::DefinitionList) &&
                    nested_model.items&.any?

  DropFactory.create(nested_model)
end

#termObject



7
8
9
# File 'lib/coradoc/html/drop/definition_item_drop.rb', line 7

def term
  Escape.escape_html(stripped_term)
end

#term_idObject



11
12
13
14
# File 'lib/coradoc/html/drop/definition_item_drop.rb', line 11

def term_id
  match = term_text.match(/\A\[\[([^\]]+)\]\]/)
  match&.[](1)
end