Class: Coradoc::Html::Drop::BlockDrop

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

#contentObject



24
25
26
# File 'lib/coradoc/html/drop/block_drop.rb', line 24

def content
  content_to_liquid(@model.renderable_content)
end

#css_classObject



19
20
21
22
# File 'lib/coradoc/html/drop/block_drop.rb', line 19

def css_class
  cls = TagMapping.css_class_for(resolved_semantic_type)
  cls ? "block-#{semantic_type} #{cls}" : "block-#{semantic_type}"
end

#hidden?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/coradoc/html/drop/block_drop.rb', line 36

def hidden?
  %i[comment reviewer].include?(resolved_semantic_type)
end

#hr?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/coradoc/html/drop/block_drop.rb', line 44

def hr?
  resolved_semantic_type == :horizontal_rule
end

#html_tagObject



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

def html_tag
  TagMapping.tag_for(resolved_semantic_type)
end

#languageObject



15
16
17
# File 'lib/coradoc/html/drop/block_drop.rb', line 15

def language
  @model.language || @model.('language')
end

#raw?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/coradoc/html/drop/block_drop.rb', line 40

def raw?
  resolved_semantic_type == :pass
end

#semantic_typeObject



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

def semantic_type
  resolved_semantic_type.to_s
end

#textObject



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

def text
  if %i[source_code literal listing].include?(resolved_semantic_type)
    Escape.escape_html(@model.flat_text)
  elsif resolved_semantic_type == :pass
    @model.flat_text.to_s
  end
end