Class: Coradoc::Html::Drop::InlineElementDrop

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/html/drop/inline_element_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

#css_classObject



29
30
31
32
33
34
35
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 29

def css_class
  case format_type
  when 'stem' then 'stem'
  when 'term' then 'term'
  when 'span' then @model.('class')
  end
end

#format_typeObject



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

def format_type
  @model.resolve_format_type
end

#hrefObject



15
16
17
18
19
20
21
22
23
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 15

def href
  case format_type
  when 'link'
    @model.target || @model.('href') || '#'
  when 'xref'
    target = @model.target || @model.('href') || ''
    "##{target}"
  end
end

#html_tagObject



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

def html_tag
  TagMapping.tag_for(format_type)
end

#term_refObject



37
38
39
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 37

def term_ref
  @model.content.to_s if format_type == 'term'
end

#textObject



25
26
27
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 25

def text
  Escape.escape_html(extract_text(@model.content))
end