Class: Coradoc::Html::Drop::DocumentDrop
Instance Attribute Summary
#section_number
Attributes inherited from Base
#model
Instance Method Summary
collapse
Methods inherited from Base
#id, #initialize, #to_liquid
Instance Method Details
#children ⇒ Object
26
27
28
|
# File 'lib/coradoc/html/drop/document_drop.rb', line 26
def children
children_to_liquid(@model.children)
end
|
#heading_level ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/coradoc/html/drop/document_drop.rb', line 40
def heading_level
if @model.is_a?(CoreModel::SectionElement)
[@model.heading_level + 1, 6].min
else
1
end
end
|
#structural_type ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'lib/coradoc/html/drop/document_drop.rb', line 30
def structural_type
case @model
when CoreModel::DocumentElement then 'document'
when CoreModel::SectionElement then 'section'
when CoreModel::HeaderElement then 'header'
when CoreModel::PreambleElement then 'preamble'
else 'structural'
end
end
|
#template_type ⇒ Object
9
10
11
12
13
|
# File 'lib/coradoc/html/drop/document_drop.rb', line 9
def template_type
return 'document' if @model.is_a?(CoreModel::DocumentElement)
'section'
end
|
#title ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/coradoc/html/drop/document_drop.rb', line 15
def title
text = TitleText.resolve(@model.title)
return nil unless text && !text.empty?
if @section_number
Escape.escape_html("#{@section_number}. #{text}")
else
Escape.escape_html(text)
end
end
|