Class: Coradoc::Html::Drop::BlockDrop
- Inherits:
-
Base
- Object
- Liquid::Drop
- Base
- Coradoc::Html::Drop::BlockDrop
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
Instance Method Details
#content ⇒ Object
24
25
26
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 24
def content
content_to_liquid(@model.renderable_content)
end
|
#css_class ⇒ Object
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
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
44
45
46
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 44
def hr?
resolved_semantic_type == :horizontal_rule
end
|
#html_tag ⇒ Object
11
12
13
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 11
def html_tag
TagMapping.tag_for(resolved_semantic_type)
end
|
#language ⇒ Object
15
16
17
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 15
def language
@model.language || @model.metadata('language')
end
|
#raw? ⇒ Boolean
40
41
42
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 40
def raw?
resolved_semantic_type == :pass
end
|
#semantic_type ⇒ Object
7
8
9
|
# File 'lib/coradoc/html/drop/block_drop.rb', line 7
def semantic_type
resolved_semantic_type.to_s
end
|
#text ⇒ Object
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
|