Class: Coradoc::Html::Drop::InlineElementDrop
- Inherits:
-
Base
- Object
- Liquid::Drop
- Base
- Coradoc::Html::Drop::InlineElementDrop
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
Instance Method Details
#css_class ⇒ Object
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.metadata('class')
end
end
|
7
8
9
|
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 7
def format_type
@model.resolve_format_type
end
|
#href ⇒ Object
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.metadata('href') || '#'
when 'xref'
target = @model.target || @model.metadata('href') || ''
"##{target}"
end
end
|
#html_tag ⇒ Object
11
12
13
|
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 11
def html_tag
TagMapping.tag_for(format_type)
end
|
#term_ref ⇒ Object
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
|
#text ⇒ Object
25
26
27
|
# File 'lib/coradoc/html/drop/inline_element_drop.rb', line 25
def text
Escape.escape_html((@model.content))
end
|